0
0
Dockerdevops~10 mins

ENTRYPOINT vs CMD difference in Docker - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the Dockerfile line to set the default command using CMD.

Docker
CMD ["[1]"]
Drag options to blanks, or click blank then click option'
ACOPY
BRUN
CENTRYPOINT
Dbash
Attempts:
3 left
💡 Hint
Common Mistakes
Using RUN instead of CMD
Confusing ENTRYPOINT with CMD
2fill in blank
medium

Complete the Dockerfile line to set the container's main executable using ENTRYPOINT.

Docker
ENTRYPOINT ["[1]"]
Drag options to blanks, or click blank then click option'
ACOPY
BCMD
Cpython
DRUN
Attempts:
3 left
💡 Hint
Common Mistakes
Using CMD instead of ENTRYPOINT
Using Dockerfile commands like COPY here
3fill in blank
hard

Complete the docker run command to override the CMD arguments and echo 'World' instead.

Docker
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["echo Hello"]
# To override CMD, use: docker run myimage [1]
Drag options to blanks, or click blank then click option'
Aecho World
B--entrypoint echo World
C--cmd echo World
D--rm
Attempts:
3 left
💡 Hint
Common Mistakes
Using --entrypoint, which overrides the ENTRYPOINT instead
Using invalid --cmd option
Confusing --rm with command override
4fill in blank
hard

Fill both blanks to create a Dockerfile snippet where ENTRYPOINT runs python and CMD passes the script name.

Docker
ENTRYPOINT ["[1]"]
CMD ["[2]"]
Drag options to blanks, or click blank then click option'
Apython
Bapp.py
Cbash
Dscript.sh
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping ENTRYPOINT and CMD values
Using bash instead of python for ENTRYPOINT
5fill in blank
hard

Fill all three blanks to write a Dockerfile snippet where ENTRYPOINT runs /bin/bash, CMD passes -c, and default command echoes Hello.

Docker
ENTRYPOINT ["[1]"]
CMD ["[2]", "[3]"]
Drag options to blanks, or click blank then click option'
A/bin/bash
B-c
Cecho Hello
D/bin/sh
Attempts:
3 left
💡 Hint
Common Mistakes
Using /bin/sh instead of /bin/bash
Missing the -c option for bash