summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Freference%2Fcommandline%2Fvolume_create%2Findex.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/docker/engine%2Freference%2Fcommandline%2Fvolume_create%2Findex.html
new repository
Diffstat (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fvolume_create%2Findex.html')
-rw-r--r--devdocs/docker/engine%2Freference%2Fcommandline%2Fvolume_create%2Findex.html35
1 files changed, 35 insertions, 0 deletions
diff --git a/devdocs/docker/engine%2Freference%2Fcommandline%2Fvolume_create%2Findex.html b/devdocs/docker/engine%2Freference%2Fcommandline%2Fvolume_create%2Findex.html
new file mode 100644
index 00000000..6e378e60
--- /dev/null
+++ b/devdocs/docker/engine%2Freference%2Fcommandline%2Fvolume_create%2Findex.html
@@ -0,0 +1,35 @@
+<h1>docker volume create</h1> <p><br></p> <p>Create a volume</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker volume create [OPTIONS] [VOLUME]
+</pre></div> <p>Refer to the <a href="#options">options section</a> for an overview of available <a href="#options"><code class="language-plaintext highlighter-rouge">OPTIONS</code></a> for this command.</p> <h2 id="description">Description</h2> <p name="extended-description">Creates a new volume that containers can consume and store data in. If a name is not specified, Docker generates a random name.</p> <p>For example uses of this command, refer to the <a href="#examples">examples section</a> below.</p> <h2 id="options">Options</h2> <table> <thead> <tr> <td>Name, shorthand</td> <td>Default</td> <td>Description</td> </tr> </thead> <tbody> <tr> <td>
+<code class="language-plaintext highlighter-rouge">--driver</code> , <code class="language-plaintext highlighter-rouge">-d</code>
+</td> <td><code class="language-plaintext highlighter-rouge">local</code></td> <td>Specify volume driver name</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--label</code></td> <td></td> <td>Set metadata for a volume</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--name</code></td> <td></td> <td>Specify volume name</td> </tr> <tr> <td>
+<code class="language-plaintext highlighter-rouge">--opt</code> , <code class="language-plaintext highlighter-rouge">-o</code>
+</td> <td></td> <td>Set driver specific options</td> </tr> </tbody> </table> <h2 id="examples">Examples</h2> <p>Create a volume and then configure the container to use it:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker volume create hello
+
+hello
+
+$ docker run -d -v hello:/world busybox ls /world
+</pre></div> <p>The mount is created inside the container’s <code class="language-plaintext highlighter-rouge">/world</code> directory. Docker does not support relative paths for mount points inside the container.</p> <p>Multiple containers can use the same volume in the same time period. This is useful if two containers need access to shared data. For example, if one container writes and the other reads the data.</p> <p>Volume names must be unique among drivers. This means you cannot use the same volume name with two different drivers. If you attempt this <code class="language-plaintext highlighter-rouge">docker</code> returns an error:</p> <div class="highlight"><pre class="highlight" data-language="">A volume named "hello" already exists with the "some-other" driver. Choose a different volume name.
+</pre></div> <p>If you specify a volume name already in use on the current driver, Docker assumes you want to re-use the existing volume and does not return an error.</p> <h3 id="driver-specific-options">Driver-specific options</h3> <p>Some volume drivers may take options to customize the volume creation. Use the <code class="language-plaintext highlighter-rouge">-o</code> or <code class="language-plaintext highlighter-rouge">--opt</code> flags to pass driver options:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker volume create --driver fake \
+ --opt tardis=blue \
+ --opt timey=wimey \
+ foo
+</pre></div> <p>These options are passed directly to the volume driver. Options for different volume drivers may do different things (or nothing at all).</p> <p>The built-in <code class="language-plaintext highlighter-rouge">local</code> driver on Windows does not support any options.</p> <p>The built-in <code class="language-plaintext highlighter-rouge">local</code> driver on Linux accepts options similar to the linux <code class="language-plaintext highlighter-rouge">mount</code> command. You can provide multiple options by passing the <code class="language-plaintext highlighter-rouge">--opt</code> flag multiple times. Some <code class="language-plaintext highlighter-rouge">mount</code> options (such as the <code class="language-plaintext highlighter-rouge">o</code> option) can take a comma-separated list of options. Complete list of available mount options can be found <a href="https://man7.org/linux/man-pages/man8/mount.8.html">here</a>.</p> <p>For example, the following creates a <code class="language-plaintext highlighter-rouge">tmpfs</code> volume called <code class="language-plaintext highlighter-rouge">foo</code> with a size of 100 megabyte and <code class="language-plaintext highlighter-rouge">uid</code> of 1000.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker volume create --driver local \
+ --opt type=tmpfs \
+ --opt device=tmpfs \
+ --opt o=size=100m,uid=1000 \
+ foo
+</pre></div> <p>Another example that uses <code class="language-plaintext highlighter-rouge">btrfs</code>:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker volume create --driver local \
+ --opt type=btrfs \
+ --opt device=/dev/sda2 \
+ foo
+</pre></div> <p>Another example that uses <code class="language-plaintext highlighter-rouge">nfs</code> to mount the <code class="language-plaintext highlighter-rouge">/path/to/dir</code> in <code class="language-plaintext highlighter-rouge">rw</code> mode from <code class="language-plaintext highlighter-rouge">192.168.1.1</code>:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker volume create --driver local \
+ --opt type=nfs \
+ --opt o=addr=192.168.1.1,rw \
+ --opt device=:/path/to/dir \
+ foo
+</pre></div> <h2 id="parent-command">Parent command</h2> <table> <thead> <tr> <th style="text-align: left">Command</th> <th style="text-align: left">Description</th> </tr> </thead> <tbody> <tr> <td style="text-align: left"><a href="../volume/index">docker volume</a></td> <td style="text-align: left">Manage volumes</td> </tr> </tbody> </table> <h2 id="related-commands">Related commands</h2> <table> <thead> <tr> <td>Command</td> <td>Description</td> </tr> </thead> <tbody> <tr> <td><a href="index">docker volume create</a></td> <td>Create a volume</td> </tr> <tr> <td><a href="../volume_inspect/index">docker volume inspect</a></td> <td>Display detailed information on one or more volumes</td> </tr> <tr> <td><a href="../volume_ls/index">docker volume ls</a></td> <td>List volumes</td> </tr> <tr> <td><a href="../volume_prune/index">docker volume prune</a></td> <td>Remove all unused local volumes</td> </tr> <tr> <td><a href="../volume_rm/index">docker volume rm</a></td> <td>Remove one or more volumes</td> </tr> </tbody> </table> <div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 2019 Docker, Inc.<br>Licensed under the Apache License, Version 2.0.<br>Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.<br>Docker, Inc. and other parties may also have trademark rights in other terms used herein.<br>
+ <a href="https://docs.docker.com/engine/reference/commandline/volume_create/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/volume_create/</a>
+ </p>
+</div>