EMERGING TRENDS IN SOFTWARE ENGINEERING
DEVOPS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
Which of the following is/are valid docker commands which will bind ports on container to the ports on the host on which it is running?
|
docker container run-P <imagename>
|
|
docker container run-P 8080:80 <imagename>
|
|
docker container run-p <imagename>
|
|
docker container run-p 8080:80 <imagename>
|
Explanation:
Detailed explanation-1: -To publish a port for our container, we’ll use the–publish flag (-p for short) on the docker run command. The format of the–publish command is [host port]:[container port] . So, if we wanted to expose port 8000 inside the container to port 8080 outside the container, we would pass 8080:8000 to the–publish flag.
Detailed explanation-2: -Expose all Docker ports. docker container run-P-d nginx. The-P command opens every port the container exposes. Expose a specific port. Example of port binding: Bind port 80 of the Docker container to port 8080 of the host machine. 03-Mar-2020
There is 1 question to complete.