0
0
Dockerdevops~10 mins

Why Docker in CI/CD matters - Test Your Understanding

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

Complete the code to build a Docker image named 'app' from the current directory.

Docker
docker build -t app [1] Dockerfile .
Drag options to blanks, or click blank then click option'
A-d
B-f
C-p
D-t
Attempts:
3 left
💡 Hint
Common Mistakes
Using -d which runs containers detached, not for building images.
2fill in blank
medium

Complete the command to run a Docker container named 'web' in detached mode.

Docker
docker run --name web [1] nginx
Drag options to blanks, or click blank then click option'
A-it
B-rm
C-p
D-d
Attempts:
3 left
💡 Hint
Common Mistakes
Using -it which runs the container interactively.
3fill in blank
hard

Fix the error in the command to push the Docker image 'app' to Docker Hub.

Docker
docker push [1]/app
Drag options to blanks, or click blank then click option'
Ausername
Bapp
Clatest
Ddocker
Attempts:
3 left
💡 Hint
Common Mistakes
Pushing without username causes 'repository not found' errors.
4fill in blank
hard

Fill both blanks to create a Dockerfile that uses the 'python:3.12' image and copies 'app.py' into the container.

Docker
FROM [1]
COPY [2] /app.py
Drag options to blanks, or click blank then click option'
Apython:3.12
Bapp.py
Cnginx:latest
Drequirements.txt
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong base image or copying wrong files.
5fill in blank
hard

Fill all three blanks to define a Docker Compose service named 'web' that builds from the current directory, maps port 5000, and restarts always.

Docker
services:
  web:
    build: [1]
    ports:
      - "[2]:5000"
    restart: [3]
Drag options to blanks, or click blank then click option'
A.
B5000
Calways
Dnever
Attempts:
3 left
💡 Hint
Common Mistakes
Wrong build path, incorrect port mapping, or wrong restart policy.