Select Page

Docker backup – Easy steps to backup and restore your containers

Docker backup – Easy steps to backup and restore your containers

Disasters cannot be predicted or prevented, but you can always quickly bounce back from them if you maintain adequate backup plans for your business.

That makes data backups indispensable for any online business. By reducing the time to restore a crashed business, backups help to save businesses and minimize the losses.

In Docker systems, containers are used to host applications or services. Today, we’ll see how to perform docker backup and restore functions for containers.

In Docker, data is categorized into two – docker images for creating containers and the container data. The container data may be stored in containers or data volumes.

Are your Docker containers insured?



How to backup Docker containers

1. Before backing up a container, you need to identify its container ID. To know the container ID of a Docker instance, you can list the containers in that system.

The containers in a Docker machine can be listed using the command ‘docker ps’.

Docker backup - container list

Docker container list


2. To backup a container in this list, use the ‘docker commit’ command with the following syntax:

docker commit -p container-ID backup-name

The container ID can be obtained from the ‘docker ps’ list and the ‘backup-name’ can be chosen based on your backup policy.

Docker backup of container

Take backup of Docker container


This snippet shows the docker backup of container ‘679facd4ee38’ (WordPress container), being taken in the name ‘backup-01’.

3. The backup image of the container, also known as ‘snapshot’, would be created with the name ‘backup-01’ and will be listed in the ‘docker images’ list:


Docker backup of container image

Docker container backup image


This image of the container can be used to restore it on a later point and retrieve the state of the container to that moment this snapshot was taken.

4. It is not advisable to store the backups in the same Docker host machine as the container, as a hardware crash in it can tamper with the backups too.

So we usually convert these backup images to compressed formats such as ‘tar’ files and copy them over to an external server.

The ‘tar’ file for the backup image can be generated using the command:

docker save -o backup-name.tar backup-name

5. The tar file would be generated as shown, which can be copied over to external locations using ‘rsync’ or ‘scp’ tools.

Container backup image compressed file

Compressed tar file of container backup image


Tools such as docker-backup can also be configured to take docker backup of containers. At Bobcares, we use custom scripts to perform backups.

The docker backup scripts are compiled based on parameters such as backup frequency, storage location, priority and importance of the container, etc.

[ Running a Docker infrastructure doesn’t have to be hard, or costly. Get world class Docker management services at affordable pricing. ]

Looking for a stable Docker setup?

Talk to our Docker specialists today to know how we can keep your containers top notch!




  1. Very Helpful Article Keep up the good work. We need heroes like you in the world!

    • True

    • Thank you for your kind words, Sean 🙂

  2. Awesome… fantastic… fabulous… great work…
    Thank you

    • Thank you for your kind words, Priya 🙂

  3. Hi Guys,

    How to backup a container with multiple “data-directory”?


    // Jonas

    • Jonas,

      It is also possible to backup data volumes. Please submit your details at and our docker experts would configure the backups for you.

  4. Nice tutorial it’s been very useful !!!


Submit a Comment

Your email address will not be published. Required fields are marked *

Bobcares is a server management company that helps businesses deliver uninterrupted and secure online services. Our engineers manage close to 51,500 servers that include virtualized servers, cloud infrastructure, physical server clusters, and more.

Privacy Preference Center


    Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

    PHPSESSID - Preserves user session state across page requests.

    gdpr[consent_types] - Used to store user consents.

    gdpr[allowed_cookies] - Used to store user allowed cookies.

    PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]


    Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

    _ga - Preserves user session state across page requests.

    _gat - Used by Google Analytics to throttle request rate

    _gid - Registers a unique ID that is used to generate statistical data on how you use the website.

    smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

    _ga, _gat, _gid
    _ga, _gat, _gid


    Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

    IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

    test_cookie - Used to check if the user's browser supports cookies.

    1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

    NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

    DV - Google ad personalisation

    IDE, test_cookie, 1P_JAR, NID, DV, NID
    IDE, test_cookie
    1P_JAR, NID, DV