0
0
Dockerdevops~10 mins

Why production patterns matter in Docker - Test Your Understanding

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

Complete the code to specify the base image in a Dockerfile.

Docker
FROM [1]
Drag options to blanks, or click blank then click option'
Aubuntu:latest
BRUN apt-get update
CCOPY . /app
DCMD python app.py
Attempts:
3 left
💡 Hint
Common Mistakes
Using commands like RUN or COPY instead of a base image.
2fill in blank
medium

Complete the code to expose port 80 in the Dockerfile.

Docker
EXPOSE [1]
Drag options to blanks, or click blank then click option'
A443
B80
C22
D8080
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing ports like 22 (SSH) or 443 (HTTPS) when HTTP port 80 is needed.
3fill in blank
hard

Fix the error in the Dockerfile command to run the app.

Docker
CMD ["python", "[1]"]
Drag options to blanks, or click blank then click option'
Aapp.py
Brun.py
Cstart.sh
Dinstall.sh
Attempts:
3 left
💡 Hint
Common Mistakes
Using setup or install scripts instead of the main app script.
4fill in blank
hard

Fill both blanks to create a volume mount and set environment variable in docker run command.

Docker
docker run -v [1] -e [2]=production myapp
Drag options to blanks, or click blank then click option'
A/host/data:/data
BDEBUG
CENV
D/data:/host/data
Attempts:
3 left
💡 Hint
Common Mistakes
Reversing host and container paths in volume mount.
Using wrong environment variable names.
5fill in blank
hard

Fill all three blanks to write a Dockerfile snippet that copies files, installs dependencies, and runs the app.

Docker
COPY [1] /app
RUN pip install [2]
CMD ["python", "[3]"]
Drag options to blanks, or click blank then click option'
A.
B-r requirements.txt
Capp.py
Dsrc
Attempts:
3 left
💡 Hint
Common Mistakes
Copying wrong folder path.
Forgetting the '-r' flag in pip install.
Running wrong script name.