CS FundamentalsVery hardProduct-company DevOps interview

A Dockerfile ends with ENTRYPOINT ["python", "app.py"] and CMD ["--port", "80"]. The container is started with docker run myimg --port 9000. What command runs inside the container?

  1. A. python app.py --port 80
  2. B. --port 9000
  3. C. python app.py --port 80 --port 9000
  4. D. python app.py --port 9000

Correct answer: D. python app.py --port 9000

With exec-form ENTRYPOINT, CMD only supplies default arguments; arguments given to docker run replace CMD and are appended to ENTRYPOINT. Overriding the entrypoint itself needs --entrypoint.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic