Answer for Kodekloud DEVOPS Questions - Docker Ports Mapping

 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 2 in Stratos Datacenter. Please perform the task as per details mentioned below:

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

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

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

Sample Answer:

#login to the correct app server as per your  question 

    ssh <user>@<app-server>

#switch to root user

    sudo su 

#pull the docker image ( check your question)

    docker pull < image from your question>

#you can cehck the image using below command 

    docker images 

#run the docker with the name and port  given in the question (check your question)

    docker run -d --name=<name from your question> -p <hostport>:<container port> <image>

#verify using below command 

    docker ps 


*Please comment on this post if you are facing any issues in the steps, also provide your feedback in the comments :)

Note: **The Question copied it for learning purposes.** Commands are correct but based on your question the server, user name, and other details might differ, so please do check.

check below video too for how to do the task (i have done a sample task on Ubuntu OS)



No comments:

Post a Comment

Featured Post

Answer for Kodekloud DEVOPS Questions - Init container in Kubernetes

Question: 1. Create a Deployment named as ic-deploy-devops. 2. Configure spec as replicas should be 1 , labels app should be ic-devops , ...