Cloud & DevOps · Question 23 · Medium

A container is started with docker run -p 8080:80 nginx. What does the -p 8080:80 option do?

  1. It forwards port 80 on the host to port 8080 inside the container
  2. It limits the container to 8080 MB of memory and 80% CPU
  3. It runs 80 copies of the container on port 8080
  4. It forwards port 8080 on the host to port 80 inside the container
Answer and explanation

Answer: D. It forwards port 8080 on the host to port 80 inside the container

Explanation: The format is -p hostPort:containerPort. Requests to the host's port 8080 reach nginx listening on port 80 inside the container.

Previous: What does this shell pipeline print? Ignore any leading spaces. · Next: What is blue-green deployment?

Practise cloud & devops

Try a fresh set of cloud & devops questions with an explanation after every answer, free and without signing up: Cloud & DevOps practice. Or sit a full placement mock test.

More cloud & devops questions

More technical & programming practice

GenAI Basics · Pseudo-code · C Programming · Java · Python · Data Structures · Algorithms · Object-Oriented Programming

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge