Today we will learn How To Take Snapshot of Running Container so we can restore it later if we required it. Having a backup of everything is better than nothing. You can have a backup of Docker containers as well as a snapshot of docker images and save the container.
How To Snapshot Backup of running a Container In Docker:
Having a Snapshot of a container is also known as Backup. There are two ways of taking a backup of a container in docker. you can easily perform these steps in the docker to save all the running container.
Two Ways of Container Backup
Check Out: Update Memory Size of Running Container
Way 1: I’m having two running containers on my docker-machine.
I’m going to take a backup of mysqltest container.
docker commit -p 78e701a98334 mysqltest-backup
Container-id = 78e701a98334
Backup name = mysqltest-backup
Check Out: Monitor Health of a Container
As you can see the backup of mysqltest created. This will create a backup as an image.
Way 2: You can also take the backup of a container image in tar form.
docker save -o mysqltest-backup.tar mysqltest-backup
Check Out: Check Logs Of a Container
YouTube link: Backup of Container
You’re done docker save container backup docker images snapshot of docker container