<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://all.docs.genesys.com/index.php?action=history&amp;feed=atom&amp;title=Docker%2FCurrent%2FDockerVolumes%2FManaging_Volumes</id>
	<title>Docker/Current/DockerVolumes/Managing Volumes - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://all.docs.genesys.com/index.php?action=history&amp;feed=atom&amp;title=Docker%2FCurrent%2FDockerVolumes%2FManaging_Volumes"/>
	<link rel="alternate" type="text/html" href="https://all.docs.genesys.com/index.php?title=Docker/Current/DockerVolumes/Managing_Volumes&amp;action=history"/>
	<updated>2026-04-06T09:09:57Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://all.docs.genesys.com/index.php?title=Docker/Current/DockerVolumes/Managing_Volumes&amp;diff=133284&amp;oldid=prev</id>
		<title>WikiSysop: Created page with &quot;{{Article |Standalone=No |DisplayName=Managing Volumes |TocName=Managing Volumes |Context=This section explains how you can create and manage volumes outside the scope of any...&quot;</title>
		<link rel="alternate" type="text/html" href="https://all.docs.genesys.com/index.php?title=Docker/Current/DockerVolumes/Managing_Volumes&amp;diff=133284&amp;oldid=prev"/>
		<updated>2024-12-03T11:00:30Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Article |Standalone=No |DisplayName=Managing Volumes |TocName=Managing Volumes |Context=This section explains how you can create and manage volumes outside the scope of any...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Article&lt;br /&gt;
|Standalone=No&lt;br /&gt;
|DisplayName=Managing Volumes&lt;br /&gt;
|TocName=Managing Volumes&lt;br /&gt;
|Context=This section explains how you can create and manage volumes outside the scope of any container.&lt;br /&gt;
|ComingSoon=No&lt;br /&gt;
|Platform=PureConnect, GenesysCloud, GenesysEngage-cloud&lt;br /&gt;
|Section={{Section&lt;br /&gt;
|alignment=Vertical&lt;br /&gt;
|structuredtext={{NoteFormat|&lt;br /&gt;
The following content has been deprecated and is maintained for reference only.&lt;br /&gt;
|3}}&lt;br /&gt;
|Status=No&lt;br /&gt;
}}{{Section&lt;br /&gt;
|sectionHeading=Create and Manage Volumes&lt;br /&gt;
|alignment=Vertical&lt;br /&gt;
|structuredtext={{{!}} class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
{{!}}-&lt;br /&gt;
{{!}}{{!}}'''Note:''' At the end of this topic, you will be provided with a terminal to an environment that has all the prerequisites (such as Docker and Kubernetes) up and running. You can practice your commands in this tutorial without any need to setup your own environment.&amp;lt;br /&amp;gt;&lt;br /&gt;
{{!}}}&lt;br /&gt;
Unlike a bind mount, you can create and manage volumes outside the scope of any container.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Create a Volume'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;$ docker volume create my-vol&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''List Volumes'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;$ docker volume ls&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;local               my-vol&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Inspect Volumes'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;$ docker volume inspect my-vol&lt;br /&gt;
[&lt;br /&gt;
    {&lt;br /&gt;
        &amp;quot;Driver&amp;quot;: &amp;quot;local&amp;quot;,&lt;br /&gt;
        &amp;quot;Labels&amp;quot;: {},&lt;br /&gt;
        &amp;quot;Mountpoint&amp;quot;: &amp;quot;/var/lib/docker/volumes/my-vol/_data&amp;quot;,&lt;br /&gt;
        &amp;quot;Name&amp;quot;: &amp;quot;my-vol&amp;quot;,&lt;br /&gt;
        &amp;quot;Options&amp;quot;: {},&lt;br /&gt;
        &amp;quot;Scope&amp;quot;: &amp;quot;local&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Remove a Volume'''&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;$ docker volume rm my-vol&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Start a Service with Volumes'''&lt;br /&gt;
&lt;br /&gt;
When you start a service and define a volume, each service container uses its own local volume. None of the containers can share this data if you use the local volume driver. However, some volume drivers do support shared storage. Docker for AWS and Docker for Azure both support persistent storage using the Cloudstor plugin.&lt;br /&gt;
&lt;br /&gt;
The following example starts a '''nginx''' service with four replicas, each of which uses a local volume called &amp;quot;myvol2'''.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
$ docker service create -d \&lt;br /&gt;
  --replicas=4 \&lt;br /&gt;
  --name devtest-service \&lt;br /&gt;
  --mount source=myvol2,target=/app \&lt;br /&gt;
  nginx:latest&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use docker service '''ps devtest-service''' to verify that the service is running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
$ docker service ps devtest-service&lt;br /&gt;
&lt;br /&gt;
ID                  NAME                IMAGE               NODE                DESIRED STATE       CURRENT STATE            ERROR               PORTS&lt;br /&gt;
4d7oz1j85wwn        devtest-service.1   nginx:latest        moby                Running             Running 14 seconds ago&lt;br /&gt;
&amp;lt;/source&amp;gt;Remove the service to stop all its tasks:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
$ docker service rm devtest-service&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Removing the service does not remove volumes created by the service.&lt;br /&gt;
==Using a Volume Driver==&lt;br /&gt;
When you create a volume using docker volume create, or when you start a container which uses a '''not-yet-created''' volume, you can specify a volume driver. The following examples use the '''vieux/sshfs''' volume driver, first when creating a standalone volume, and then when starting a container which creates a new volume.&lt;br /&gt;
&lt;br /&gt;
'''Initial set-up'''&lt;br /&gt;
&lt;br /&gt;
This example assumes that you have two nodes, the first of which is a Docker host and can connect to the second using SSH.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
On the Docker host, install the vieux/sshfs plugin:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
$ docker plugin install --grant-all-permissions vieux/sshfs&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
==Create a Volume using a Volume Driver==&lt;br /&gt;
This example specifies a SSH password, but if the two hosts have shared keys configured, you can omit the password. Each volume driver may have zero or more configurable options, each of which is specified using an -o flag.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
$ docker volume create --driver vieux/sshfs \&lt;br /&gt;
  -o sshcmd=test@node2:/home/test \&lt;br /&gt;
  -o password=testpassword \&lt;br /&gt;
  sshvolume&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Start a Container Which Creates a Volume Using a Volume Driver==&lt;br /&gt;
This example specifies a SSH password, but if the two hosts have shared keys configured, you can omit the password. Each volume driver may have zero or more configurable options. If the volume driver requires you to pass options, you must use the --mount flag to mount the volume, rather than -v.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
$ docker run -d \&lt;br /&gt;
  --name sshfs-container \&lt;br /&gt;
  --volume-driver vieux/sshfs \&lt;br /&gt;
  --mount src=sshvolume,target=/app,volume-opt=sshcmd=test@node2:/home/test,volume-opt=password=testpassword \&lt;br /&gt;
  nginx:latest&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
==Backup, Restore, or Migrate Data Volumes==&lt;br /&gt;
Volumes are useful for backups, restores, and migrations. Use the --volumes-from flag to create a new container that mounts that volume.&lt;br /&gt;
===Backup a Container===&lt;br /&gt;
For example, in the next command, we:&lt;br /&gt;
&lt;br /&gt;
*Launch a new container and mount the volume from the dbstore container&lt;br /&gt;
*Mount a local host directory as /backup&lt;br /&gt;
*Pass a command that tars the contents of the dbdata volume to a backup.tar file inside our /backup directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
$ docker run --rm --volumes-from dbstore -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /dbdata&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the command completes and the container stops, we are left with a backup of our dbdata volume.&lt;br /&gt;
&lt;br /&gt;
===Restore Container from Backup===&lt;br /&gt;
With the backup just created, you can restore it to the same container, or another that you made elsewhere.&lt;br /&gt;
&lt;br /&gt;
For example, create a new container named dbstore2:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
$ docker run -v /dbdata --name dbstore2 ubuntu /bin/bash&lt;br /&gt;
Then un-tar the backup file in the new container`s data volume:&lt;br /&gt;
$ docker run --rm --volumes-from dbstore2 -v $(pwd):/backup ubuntu bash -c &amp;quot;cd /dbdata &amp;amp;&amp;amp; tar xvf /backup/backup.tar --strip 1&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the techniques above to automate backup, migration and restore testing using your preferred tools.&lt;br /&gt;
===Remove Volumes===&lt;br /&gt;
A Docker data volume persists after a container is deleted. There are two types of volumes to consider:&lt;br /&gt;
&lt;br /&gt;
*Named volumes have a specific source form outside the container, for example awesome:/bar.&lt;br /&gt;
*Anonymous volumes have no specific source so when the container is deleted, instruct the Docker Engine daemon to remove them.&lt;br /&gt;
&lt;br /&gt;
===Remove Anonymous Volumes===&lt;br /&gt;
To automatically remove anonymous volumes, use the --rm option. For example, this command creates an anonymous /foovolume. When the container is removed, the Docker Engine removes the /foo volume but not the awesome volume.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
$ docker run --rm -v /foo -v awesome:/bar busybox top&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
===Remove All Volumes===&lt;br /&gt;
To remove all unused volumes and free up space:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
$ docker volume prune&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;span class=&amp;quot;co3&amp;quot;&amp;gt;$ docker volume prune&amp;lt;/span&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- NewPP limit reportCPU time usage: 0.004 secondsReal time usage: 0.002 secondsPreprocessor visited node count: 4/1000000Preprocessor generated node count: 24/1000000Post‐expand include size: 0/10485760 bytesTemplate argument size: 0/10485760 bytesHighest expansion depth: 2/40Expensive parser function count: 0/100--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Transclusion expansion time report (%,ms,calls,template)100.00%    0.000      1 - -total--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can practice the above-mentioned commands using the following widget:&amp;lt;br /&amp;gt;{{#widget:Katacoda|divid=myScenario|scenario=docker/deploying-first-container|height=800px}}&lt;br /&gt;
|Status=No&lt;br /&gt;
}}&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
		
	</entry>
</feed>