0
0
Dockerdevops~10 mins

Common container startup failures in Docker - Interactive Code Practice

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

Complete the command to start a Docker container in detached mode.

Docker
docker run [1] nginx
Drag options to blanks, or click blank then click option'
A--name
B--rm
C-p
D-d
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--rm' which removes the container after it stops.
Using '-p' which is for port mapping.
Using '--name' which names the container.
2fill in blank
medium

Complete the command to map port 8080 on the host to port 80 in the container.

Docker
docker run -p [1]:80 nginx
Drag options to blanks, or click blank then click option'
A8080
B443
C80
D3000
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the ports and using '80:8080' which maps the wrong way.
Using port 443 which is for HTTPS by default.
Using port 3000 which is unrelated here.
3fill in blank
hard

Fix the error in the Dockerfile to set the working directory.

Docker
WORKDIR [1]/app
Drag options to blanks, or click blank then click option'
Ausr/local
B/usr/local
C/usr/local/
Dusr/local/
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the leading slash causing path errors.
Adding trailing slashes inconsistently.
Using relative paths instead of absolute.
4fill in blank
hard

Fill both blanks to create a Docker volume mount for persistent data.

Docker
docker run -v [1]:[2] nginx
Drag options to blanks, or click blank then click option'
A/host/data
B/container/data
C/data
D/var/lib
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping host and container paths.
Using relative paths instead of absolute.
Using system directories that may cause permission issues.
5fill in blank
hard

Fill all three blanks to write a Dockerfile command that copies files and sets environment variables.

Docker
COPY [1] [2]
ENV [3]=production
Drag options to blanks, or click blank then click option'
Asrc/
B/app/
CNODE_ENV
Ddist/
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong source or destination paths.
Forgetting to set environment variables correctly.
Mixing up COPY and ADD commands.