0
0
Dockerdevops~10 mins

Hot reloading with bind mounts in Docker - Interactive Code Practice

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

Complete the Docker run command to mount the current directory into the container for hot reloading.

Docker
docker run -v [1]:/app myapp
Drag options to blanks, or click blank then click option'
A$(pwd)
B/home/user
C/var/www
D/app
Attempts:
3 left
💡 Hint
Common Mistakes
Using a fixed path instead of the current directory
Forgetting to mount the directory
Mounting the wrong directory
2fill in blank
medium

Complete the docker-compose volume syntax to bind mount the local src folder to /app/src in the container.

Docker
volumes:
  - [1]:/app/src
Drag options to blanks, or click blank then click option'
A/src
B/var/src
C/app/src
D./src
Attempts:
3 left
💡 Hint
Common Mistakes
Using absolute paths that don't exist locally
Mounting to the wrong container path
Omitting the local folder path
3fill in blank
hard

Fix the error in this Dockerfile command to copy source files for hot reloading.

Docker
COPY [1] /app
Drag options to blanks, or click blank then click option'
A./src
Bsrc/
C/src
Dapp/src
Attempts:
3 left
💡 Hint
Common Mistakes
Using absolute paths starting with /
Using incorrect folder names
Omitting trailing slash when needed
4fill in blank
hard

Fill both blanks to complete the docker-compose service for hot reloading with bind mounts.

Docker
services:
  web:
    volumes:
      - [1]:[2]
Drag options to blanks, or click blank then click option'
A./app
B/app
C/usr/src/app
D./src
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping local and container paths
Using absolute local paths
Mounting wrong folders
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that watches files for changes and triggers reload.

Docker
reload_map = { [1]: [2] for [3] in files if changed([3]) }
Drag options to blanks, or click blank then click option'
Afile
BTrue
Cfiles
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong variable names
Incorrect comprehension syntax
Missing the condition