Services and User Management

A developer wants a container that always starts the application with python app.py, while the default arguments --port 8080 can be replaced at run time, so that docker run myimg --port 9090 starts the app on port 9090. Which Dockerfile instructions achieve this?

Show the answer

Correct answerB. ENTRYPOINT ["python","app.py"] followed by CMD ["--port","8080"]

ENTRYPOINT fixes the executable, and CMD supplies default arguments that arguments given to docker run replace. A lone CMD is replaced entirely, so --port 9090 would be run as the command and fail.