How many CMD instructions can be in a Dockerfile?
Experience Level: Senior
Tags: Docker
Answer
There can only be one CMD instruction in a Dockerfile. If you list more than one CMD then only the last CMD will take effect.
Related Docker job interview questions
What is the SHELL instruction good for in Docker?
Docker SeniorHow do ENTRYPOINT and CMD instructions interact?
Docker SeniorWhat is the CMD instruction good for in Docker?
Docker SeniorWhat is the EXPOSE instruction good for in Docker?
Docker SeniorWhat is the VOLUME instruction good for in Docker?
Docker Senior