0
0
Dockerdevops~10 mins

WORKDIR instruction for directory in Docker - Interactive Code 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 working directory to /app.

Docker
WORKDIR [1]
Drag options to blanks, or click blank then click option'
A/home
B/app
C/var
D/usr
Attempts:
3 left
💡 Hint
Common Mistakes
Using a directory that does not exist or is unrelated to the app.
Forgetting the leading slash for absolute paths.
2fill in blank
medium

Complete the Dockerfile to set the working directory to a folder named 'src' inside /usr.

Docker
WORKDIR [1]
Drag options to blanks, or click blank then click option'
A/usr/src
B/usr/bin
C/usr/local
D/usr/lib
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing system folders like /usr/bin which are not for app source code.
Missing the 'src' folder in the path.
3fill in blank
hard

Fix the error in this Dockerfile line to set the working directory to /data.

Docker
WORKDIR [1]
Drag options to blanks, or click blank then click option'
AC:/data
Bdata
C/data
D./data
Attempts:
3 left
💡 Hint
Common Mistakes
Using relative paths like 'data' or './data'.
Using Windows-style paths like 'C:/data'.
4fill in blank
hard

Fill both blanks to set the working directory to /var/www/html.

Docker
WORKDIR /[1]/[2]
Drag options to blanks, or click blank then click option'
Avar
Bwww
Chtml
Dusr
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'usr' instead of 'var' as the first folder.
Swapping 'www' and 'html' positions.
5fill in blank
hard

Fill all three blanks to set the working directory to /opt/project/src.

Docker
WORKDIR /[1]/[2]/[3]
Drag options to blanks, or click blank then click option'
Aopt
Bproject
Csrc
Dbin
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'bin' instead of 'src' as the last folder.
Mixing folder order.