Skip to content
Browse docs

Docker Volumes: Keep, Back Up, and Restore Your Data

The Volumes tab lists the storage your containers use, with its size and who uses it. Create and delete volumes, open their files, schedule backups to S3 or to the same server, and restore a volume from any backup, even on another server.

Open in
Updated

A volume is where your data lives, so it stays when a container is removed. The Volumes tab shows every volume on this server, and how to keep that data safe.

The In use column names the container that uses each volume. A dash means no container does.

Find what you need

I want toInstead of typingGo to
See my volumes and their sizedocker volume ls, docker system df -vRead the list
See who uses a volumedocker volume inspectSee the details
Back up a volumeA tar command and a cron lineBack up a volume
Get my data backA tar command in a helper containerRestore a volume
Move a volume to another servertar, scp, then tar againMove a volume
Look at the filessudo ls /var/lib/docker/volumes/...Open its files
Make a new volumedocker volume createCreate a volume
Delete a volumedocker volume rmDelete a volume
Free up diskdocker volume pruneRemove unused

Read the volume list

Each row shows the name, driver, size, the containers that use it, and where it is on the server. Search volumes… finds a volume by its name, driver, or stack. Use In use and Unused to filter the list.

Two marks can show next to a name:

MarkWhat it means
anonymousDocker made it with a random name, because the container did not name one. It is harder to tell what is inside, and it cannot be backed up until you give it a name
stackA Compose stack made it. If you delete it, the stack makes a new empty one at its next deploy

Sizes can take a moment to show, because Docker has to measure each volume.

See the details of a volume

Click a row to open its details: the Summary, Used by with the path in each container, Labels, and Options. Used by is the place to check before you delete a volume. A stopped container counts as using it too.

Back up a volume

Open the container

In the Containers tab, click a container that uses the volume, then open its Volumes tab.

Set up in the Backup column starts a backup of that volume.

Click Set up

Each mount has a backup column. Click Set up to open the backup panel.

The backup panel opens under the mount. It shows the next run and which containers stop.

Choose where the backups go

ChoiceWhere they goUse it when
S3 destinationYour S3 bucketAlmost always. Your data is safe if the server dies
Volume backupThis same serverYou want quick local copies. If you lose this server, you also lose these backups

For S3, pick a saved destination, or click + Add destination and click Test connection. The fields are the same as in the Backup tab, and destinations are shared between the two.

Choose when and how many

  • Scheduler: from every minute to every year, or custom with a cron expression. Once a day is enough for most data. Times use the time zone of the server, and the panel shows the next run.
  • Keep last backups: how many copies to keep, from 1 to 1000. Older ones go only after a new backup succeeds.
  • Stop container: stops the containers that use the volume during the backup, then starts them again.
  • Backup prefix (optional): added to the start of each file name, such as daily-.

Create and test it

Click Create, then click Start backup to make the first one now. Do not wait for the schedule to find out if it works.

CtrlOps may ask to install rclone or cron on the server first. Backups run on the server, so they keep running while CtrlOps is closed.

Once a volume has a backup, its cell shows the schedule and a colored dot. Click it to see Last run, Restore points, and Runs. To get a message when a backup fails, turn on the Backup failed or late alert in the Alerts tab.

Back up the volumes of a new stack

When you create a container or deploy a Compose stack, the Container stack table has a backup column. Click Set up to open Volumes to back up, then tick Enable backup for this volume. Bind folders are set up from the Volumes tab of the container instead.

Restore a volume

Open the backup panel

Open the container, go to its Volumes tab, and click the backup cell of the volume. If the container is gone, see Restore when the container is gone.

Pick a restore point

Restore points lists every backup with its time and size. Click Restore… on the one you want. You can also Download it to your computer.

Choose where it goes

OptionWhat happensUse it when
Restore to the volumeThe current data is replaced. Containers stop during the restore and start again after itYou want to go back to that backup
Restore to a new volumeThe backup goes into a new volume. Nothing else changesYou want to look at old data first, or copy one file back
The dialog names the containers it will stop before you confirm.

Confirm

Type the volume name and click Restore. For a restore over the current volume, each step shows as it runs: get the backup, check it, stop the containers, copy the current data, empty the volume, restore the backup, and start the containers.

A new volume is not attached to anything. To use it, add it to a container or name it in a compose file.

Restore when the container is gone

Click Restore from a destination… at the top of the Volumes tab. Pick the Destination, the Server, the Volume or folder, and the Restore point. If the volume no longer exists, CtrlOps makes it.

This works for backups in S3 destinations saved on this device.

Move a volume to another server

  1. On the first server, back up the volume to an S3 destination, and click Start backup.
  2. Connect to the second server and open its Volumes tab.
  3. Click Restore from a destination…, pick the first server, the volume, and the backup.
  4. Start your container on the new server with that volume.

Open the files in a volume

Click the folder icon (Open in File Manager) on the row to go to the folder of the volume in the File Manager. This works for volumes that use the local driver.

Create a volume

You rarely need this. When you create a container and type a new name under Volume mounts, such as app-data:/data, Docker makes the volume for you.

To make one first, click Create volume, type a Name, and leave the Driver on local unless you use a volume plugin. Driver options and Labels are optional. Do not put secrets in Driver options, because anyone who can run Docker can read them.

Delete a volume

Click the bin icon (Delete) on the row and type the name of the volume to confirm.

If a container uses the volume, Delete is off and names the container. Delete or change that container first.

Remove unused volumes

Click Remove unused to see the volumes no container uses. Each shows its size, or size unknown if Docker has not measured it. Anonymous volumes are ticked for you, and named volumes are not, because a name usually means someone wanted to keep that data.

Remove unused is at the top of the Volumes tab.

Tick what you want gone, and type delete and the number you ticked, such as delete 2, to confirm. Before you tick a named volume, ask yourself if its container was just deleted and you plan to bring it back.

Named volumes start unticked, so nothing goes by accident. The number to type follows what you tick.

Tips

  • Name your volumes. billing-db-data tells you what is inside, and only named volumes can be backed up.
  • Back up to S3, not to the same server. A backup on the same server is gone when the server is gone.
  • Test a restore once, to a new volume. A backup you have never restored is a backup you only hope works.

Troubleshooting

Most failures show Show details with the Likely cause, Retry where it helps, and Copy report. Send that report with any support question.

Give the volume a name first. A recreate gives an anonymous volume a new name.

An anonymous volume cannot be backed up, because its name changes when the container is recreated. Change the mount to a named volume, then recreate the container.

tmpfs data is in memory only. CtrlOps cannot make a backup of it.

A tmpfs mount keeps its files in memory, and they are gone when the container stops. Use a volume for data you want to keep.

A backup stopped 1 container and did not start it.

A backup with Stop container ended before it could start the container again, for example when the server restarted. Click Start it.

The schedule of this backup is not in the crontab.

Someone or something removed the cron line. Click Repair to put it back. If the message is The crontab has a backup schedule, but the backup is not on the server., click Remove.

Another device made this backup.

The S3 keys are saved on the computer that made it. To change the backup here, add the same destination with its keys on this computer.

There is not enough free disk space.

The message says how much CtrlOps needs. A restore needs room for the backup, and for the copy of the current data. Use Prune System to free some, then try again.

The restore failed. CtrlOps put the current data back.

Your data is as it was before the restore. Open Show details to read why it failed. If the message says CtrlOps could not put the data back, it names the folder that holds the copy.

You need sudo to open this folder.

The folder of a volume belongs to root. Connect with a login that has sudo rights, and type the password when CtrlOps asks. Volumes on other drivers cannot open in the File Manager.

Docker did not send the volume sizes in 60 seconds.

Measuring sizes is slow on a server with many volumes or files. Click Refresh to read them again. The rest of the list still works.

Docker does not have this volume driver.

Install the volume plugin on the server, or choose the local driver.

Frequently Asked Questions

Does deleting a container delete its volume?

A named volume stays on the server when you delete its container. An anonymous volume goes only if you tick Also remove anonymous volumes. A volume is removed only when you delete it yourself or remove it as unused.

Where do I set up a volume backup?

Not in the Volumes tab. Open a container that uses the volume, go to its Volumes tab, and click Set up in the backup column. You can also set up backups in the Container stack table when you create a container or deploy a Compose stack.

Does CtrlOps have to be open for a backup to run?

No. A scheduled backup runs on the server through cron, so it runs while CtrlOps and your computer are off.

Is it safe to back up a running database?

A copy of a running database can be broken, so turn on Stop container. CtrlOps turns it on by default for a database volume. The container stops during the backup, and CtrlOps starts it again afterwards.

How do I move a volume to another server?

Back it up to S3 on the first server. Connect to the second server, open the Volumes tab, click Restore from a destination…, and pick the backup. CtrlOps makes the volume if it is not there.

How are volume backups different from the Backup tab?

Volume backups are for Docker volumes and bind folders of a container, and they can stop the container during the backup. The Backup tab is for any folder on the server. Both use the same destinations, and volume backups also show in the Backup tab with a Docker tag.

Ask AI

Your privacy preferences. We use product analytics to improve CtrlOps. Google measurement runs without analytics cookies. Live chat stays off until you allow it. Cookie policy