<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hanin Mestrah on Medium]]></title>
        <description><![CDATA[Stories by Hanin Mestrah on Medium]]></description>
        <link>https://medium.com/@hanin78mestrah?source=rss-fe3fbc61e3a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*YdQn1wn5osiO7zM4tzk3dw.jpeg</url>
            <title>Stories by Hanin Mestrah on Medium</title>
            <link>https://medium.com/@hanin78mestrah?source=rss-fe3fbc61e3a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 00:37:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hanin78mestrah/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Backup and Restore Docker Containers: A Quick Guide]]></title>
            <link>https://medium.com/munchy-bytes/backup-and-restore-docker-containers-a-quick-guide-640b1b135207?source=rss-fe3fbc61e3a------2</link>
            <guid isPermaLink="false">https://medium.com/p/640b1b135207</guid>
            <category><![CDATA[backup]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[docker-container]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[docker-image]]></category>
            <dc:creator><![CDATA[Hanin Mestrah]]></dc:creator>
            <pubDate>Sat, 14 Jan 2023 17:09:12 GMT</pubDate>
            <atom:updated>2023-01-14T17:09:12.948Z</atom:updated>
            <content:encoded><![CDATA[<p>A backup is created when data is saved on a suitable storage medium. Once a backup has been completed successfully, a backup copy will be accessible for data restoration. If your system fails or becomes infected with a virus, you must be able to restore business and customer data promptly; otherwise, you run the danger of suffering significant financial losses. Furthermore, if dissatisfied clients are abruptly compelled to wait longer for their commercial operations, it could potentially harm a good reputation developed over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jTYDaxwrl7rIMuwq.jpg" /><figcaption>Image Reference: <a href="https://www.filecloud.com/blog/2018/07/backup-mistakes-that-companies-continue-to-commit/#.Y734BMtBzDc">filecloud.com</a></figcaption></figure><p>This article illustrates the different Docker commands that can be used to perform backup and restore operations.</p><h3>Docker Image vs Container: a remainder</h3><p>First, the difference between Docker containers and images is worth mentioning to remove any confusion.</p><p><strong>A Docker image </strong>contains the basic package, the application configuration, and the dependencies. A <strong>Docker container</strong> is a deployed and running Docker image. In other words, it is an instance of a docker image.</p><p>A Docker container consists of the initial Docker image, an internal file system, environment variables, and a network adapter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/0*ahgE80pD6hqAMU5u.png" /><figcaption>Basic Docker commands (Reference: <a href="https://stackoverflow.com/questions/23735149/what-is-the-difference-between-a-docker-image-and-a-container">Stackoverflow.com</a>)</figcaption></figure><h3>Docker Data</h3><p>Docker is a software platform that makes it simple to develop, test, and deploy applications. Docker packages software into standardized units called containers containing all the needed things, such as system tools and libraries. For an application to run swiftly and consistently across different computer environments, code and its dependencies are packaged into the container.</p><p>However, operating system images are not present within containers, unlike server or machine virtualization methods. As a result, they become substantially more portable and lightweight.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4Y-KN6M2EO7LAYmy" /><figcaption>Docker architecture (Reference: <a href="https://jfrog.com/knowledge-base/the-basics-a-beginners-guide-to-docker/">the basics a beginners guide to docker</a>)</figcaption></figure><p>Docker data is dispersed among many Docker files and objects. Unfortunately, there isn’t a single method for backing up specific Docker data. The use of multiple instructions is possible, though.</p><h3>Saving Docker Data</h3><p>There is no need for a backup if you utilize volumes or bind mounts to store your container data, but keep in mind the configurations and options available to you when constructing the container.</p><h4>Docker Commit</h4><p>To commit your container (current file system, environment variables, and images) to a new tagged image, you can use the <em>docker commit </em>command:</p><pre>docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]</pre><p>A container’s filesystem modifications and some of its configurations are stored when a container is committed. Take into consideration the sensitive information.</p><h4>Backing up Volumes</h4><p>When you build a volume, it is kept on the Docker host in a directory. This directory is what is mounted inside the container when the volume is mounted. Similar to how bind mounts behave, but with volumes controlled by Docker and separated from the host machine’s essential operations.</p><p>To create a volume you can refer to <em>docker volume create </em>command<em>:</em></p><pre>docker volume create</pre><p>For storing container’s data within a volume you should pass the directory and volume information as an argument to the <em>docker run </em>command<em>:</em></p><pre>docker run -v /dbdata — name dbstore ubuntu /bin/bash  for backup,</pre><p>Then, we can use the command below to backup the data stored within the volume.</p><pre>docker run — rm — volumes-from dbstore -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /dbdata</pre><p>Refer to the <em>docker volume prune</em> command to remove unused volumes.</p><pre>docker volume prune</pre><p>Refer to the <a href="https://docs.docker.com/storage/volumes/#back-up-restore-or-migrate-data-volumes"><strong>backup, restore, or migrate data volumes</strong></a> page in the storage section to restore volume data.</p><h3>Backing up and Restoring Docker Images</h3><p>Mainly, backing up and restoring Docker images using external files is done using two commands: <em>docker save</em> and <em>docker load</em>.</p><h4>Docker Save</h4><p>It is used to save one or more images to a tar archive.</p><pre>docker image save [OPTIONS] IMAGE [IMAGE...]</pre><p>The output tar archive should be passed after the <em>-o</em> argument.</p><pre>docker image save -o images.tar image1 [image2 …]</pre><h4>Docker load</h4><p>This command is used to load an image from a tar archive.</p><pre>docker image load [OPTIONS]</pre><p>To restore saved images previously, we should specify the input tar file after the <em>-i</em> argument.</p><pre>docker image load -i images.tar</pre><h4>Pushing and Pulling images</h4><p>Alternatively, we can backup images to an online repository using the docker pull (By default, images are uploaded to the Docker Hub). We can use the <em>docker push</em> command to upload to the Docker Hub any image you have locally created and wish to maintain.</p><pre>docker push</pre><blockquote>Make sure to configure the <a href="https://docs.docker.com/docker-hub/repos/configure/"><strong>repository’s visibility as “private”</strong></a> for images that should not be publicly accessible.</blockquote><p>To download images from a docker repository, we can use the <em>docker pull</em> command:</p><pre>docker pull</pre><h3>Backing up and Restoring Docker Containers</h3><p>Backing up and restoring containers is mainly done using two commands: <em>docker import</em> and <em>docker export</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MEYm9rNibYDbLVhQ.png" /><figcaption>Image Reference: PSPDFKit.com</figcaption></figure><h4>Docker Export</h4><p>By exporting this means that Docker containers exports a copy of the file system inside the container.</p><pre>docker export [OPTIONS] CONTAINER</pre><h4>Docker Import</h4><p>By importing the content from an archive or tarball that is produced by exporting a container, Docker import creates a Docker image. When importing data or information from the archive, we might specify a URL or a dash (-).</p><pre>docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]</pre><h3>Conclusion</h3><p>To sum up, in this article, we explained different methods used to backup and restore docker containers and images. Commands can be summarized as follows:</p><ul><li><strong>docker pull, docker push:</strong> used to backup and restore images to a online repository.</li><li><strong>docker save, docker load:</strong> used to backup and restore images to a local file.</li><li><strong>docker import, docker export: </strong>used to backup and restore containers to a local file.</li></ul><h3><strong>References</strong></h3><ul><li><a href="https://docs.docker.com/storage/volumes/#back-up-restore-or-migrate-data-volumes">Volumes | Docker Documentation</a></li><li><a href="https://www.ionos.com/digitalguide/server/security/what-is-a-backup/">What is a Backup and how is it done? — IONOS</a></li><li><a href="https://stackoverflow.com/questions/23735149/what-is-the-difference-between-a-docker-image-and-a-container">What is the difference between a Docker image and a container? — Stack Overflow</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=640b1b135207" width="1" height="1" alt=""><hr><p><a href="https://medium.com/munchy-bytes/backup-and-restore-docker-containers-a-quick-guide-640b1b135207">Backup and Restore Docker Containers: A Quick Guide</a> was originally published in <a href="https://medium.com/munchy-bytes">Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>