beginnerDockerfile Instructions & Multi-Stage Builds

What happens if both CMD and ENTRYPOINT are defined in a Dockerfile?

ENTRYPOINT is treated as the executable; CMD's value (each array element) is appended as arguments to it. For example, ENTRYPOINT ["java","-jar","app.jar"] with CMD ["--server.port=9090"] results in the container running java -jar app.jar --server.port=9090. Running docker run image --server.port=8081 replaces only the CMD portion.

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full DevOps Mastery library.

What happens if both CMD and ENTRYPOINT are defined in a Dockerfile?

Next Step

Continue to What is a multi-stage build and why use one?← Back to all Docker questions