Docker Ports Mapping


Docker Ports Mapping

Task :

The Nautilus DevOps team is planning to host an application on a nginx-based container. There are number of tickets already been created for similar tasks. One of the tickets has been assigned to set up a nginx container on Application Server 1 in Stratos Datacenter. Please perform the task as per details mentioned below:

a. Pull nginx:alpine docker image on Application Server 1.

b. Create a container named blog using the image you pulled.

c. Map host port 6100 to container port 80. Please keep the container in running state.

Solution :

[root@stapp01 tony]# docker pull nginx:alpine
alpine: Pulling from library/nginx
540db60ca938: Pull complete 
197dc8475a23: Pull complete 
39ea657007e5: Pull complete 
37afbf7d4c3d: Pull complete 
0c01f42c3df7: Pull complete 
d590d87c9181: Pull complete 
Digest: sha256:07ab71a2c8e4ecb19a5a5abcfb3a4f175946c001c8af288b1aa766d67b0d05d2
Status: Downloaded newer image for nginx:alpine
[root@stapp01 tony]# docker container run -d --name blog -p 6100:80 nginx:alpine
[root@stapp01 tony]# docker ps -a
d12db2b92b00 nginx:alpine "/docker-entrypoint.…" 7 seconds ago Up 5 seconds>80/tcp blog
[root@stapp01 tony]# curl http://localhost:6100/
<!DOCTYPE html>
<title>Welcome to nginx!</title>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href=""></a>.<br/>
Commercial support is available at
<a href=""></a>.</p>

<p><em>Thank you for using nginx.</em></p>
[root@stapp01 tony]#

Leave a Reply

Your email address will not be published. Required fields are marked *