Sign inSign up free

844. Data Lost on Every Recreate

medium 20 XP ~10 minHands-on lab

Labs have no container engine, so nothing is started: your files are checked with docker-compose config.

In /home/student/projects/profile/compose.yaml: Postgres refuses to start on some hosts (data directory has wrong ownership), Redis comes back empty after every docker compose up --force-recreate, and the app can overwrite its own configuration.

Task

ServiceMount
dbnamed volume pgdata at /var/lib/postgresql/data
cachenamed volume redisdata at /data
appthe host directory ./config at /etc/profile, read-only; named volume uploads at /srv/uploads
backupthe same uploads volume at /backup/uploads, read-only

Declare the three named volumes at the top level. No other mounts.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Part of Docker Fundamentals. Next step: Limit CPU, Memory and Processes in Compose

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.