QuestionQ227

Application Deployment and Security

A developer created a Dockerfile and has already built a web-application container image named myWebApp. Requests sent to the server’s public IP address on port 8080 must be redirected to port 80 in the container. The developer wants to start the container and access the Bash shell while the application serves requests. Which command should be used?

  • A
  • B
  • C
  • D
Explanation

docker run creates and starts a new container. The -p 8080:80 option publishes host port 8080 to port 80 in the container, while -i keeps standard input open and -t allocates a pseudo-terminal for an interactive Bash session. Docker documents docker run as the command to create and run a container, -p as the port-publishing option, and -i/-t as interactive-terminal options.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!