The Nautilus DevOps team is preparing to host an application using an nginx
-based container. A ticket has been assigned to set up an nginx
container on Application Server 3 in the Stratos Datacenter. The specific tasks are as follows:
- Pull the
nginx:alpine-perl
Docker image on Application Server 3. - Create a container named
demo
using the pulled image. - Map the host port
8089
to the container port80
. - Ensure that the container is running at the end of the setup.
Follow these steps to complete the setup:
-
Pull the Docker Image
First, pull the
nginx:alpine-perl
image from the Docker repository. This image includesnginx
with Perl support and is based on the Alpine Linux distribution.docker pull nginx:alpine-perl
This command downloads the image to your local Docker environment on Application Server 3.
-
Create and Run the Container
Next, create and run a new container named
demo
using thenginx:alpine-perl
image. Map the host port8089
to the container port80
to make the web service accessible on port8089
of the host.docker run -d -it --name=demo -p 8089:80 nginx:alpine-perl
In this command:
-d
runs the container in detached mode, so it operates in the background.-it
allows for interactive terminal access if needed.--name=demo
assigns the namedemo
to the container.-p 8089:80
maps port8089
on the host to port80
inside the container, enabling access to thenginx
web server from the host’s port8089
.nginx:alpine-perl
specifies the image to use for creating the container.
-
Verify the Container is Running
After running the container, confirm that it is up and running by listing all active containers:
docker container ls
Look for the
demo
container in the output to ensure it is in a running state.