Complete the Dockerfile line to set the default command using CMD.
CMD ["[1]"]
The CMD instruction sets the default command to run when the container starts, such as bash.
Complete the Dockerfile line to set the container's main executable using ENTRYPOINT.
ENTRYPOINT ["[1]"]
ENTRYPOINT sets the main executable for the container, like python to run Python scripts.
Complete the docker run command to override the CMD arguments and echo 'World' instead.
ENTRYPOINT ["/bin/sh", "-c"] CMD ["echo Hello"] # To override CMD, use: docker run myimage [1]
CMD provides default arguments to the ENTRYPOINT, which can be overridden by simply passing arguments after the image name in docker run: docker run myimage echo World executes /bin/sh -c echo World.
Fill both blanks to create a Dockerfile snippet where ENTRYPOINT runs python and CMD passes the script name.
ENTRYPOINT ["[1]"] CMD ["[2]"]
ENTRYPOINT runs python and CMD provides the default script app.py to run.
Fill all three blanks to write a Dockerfile snippet where ENTRYPOINT runs /bin/bash, CMD passes -c, and default command echoes Hello.
ENTRYPOINT ["[1]"] CMD ["[2]", "[3]"]
ENTRYPOINT runs /bin/bash, CMD passes -c and the command echo Hello to execute.