summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Freference%2Fcommandline%2Fcommit%2Findex.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fcommit%2Findex.html')
-rw-r--r--devdocs/docker/engine%2Freference%2Fcommandline%2Fcommit%2Findex.html66
1 files changed, 66 insertions, 0 deletions
diff --git a/devdocs/docker/engine%2Freference%2Fcommandline%2Fcommit%2Findex.html b/devdocs/docker/engine%2Freference%2Fcommandline%2Fcommit%2Findex.html
new file mode 100644
index 00000000..f5402e6f
--- /dev/null
+++ b/devdocs/docker/engine%2Freference%2Fcommandline%2Fcommit%2Findex.html
@@ -0,0 +1,66 @@
+<h1>docker commit</h1> <p><br></p> <p>Create a new image from a container’s changes</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
+</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">It can be useful to commit a container’s file changes or settings into a new image. This allows you to debug a container by running an interactive shell, or to export a working dataset to another server. Generally, it is better to use Dockerfiles to manage your images in a documented and maintainable way. <a href="../tag/index">Read more about valid image names and tags</a>.</p> <p>The commit operation will not include any data contained in volumes mounted inside the container.</p> <p>By default, the container being committed and its processes will be paused while the image is committed. This reduces the likelihood of encountering data corruption during the process of creating the commit. If this behavior is undesired, set the <code class="language-plaintext highlighter-rouge">--pause</code> option to false.</p> <p>The <code class="language-plaintext highlighter-rouge">--change</code> option will apply <code class="language-plaintext highlighter-rouge">Dockerfile</code> instructions to the image that is created. Supported <code class="language-plaintext highlighter-rouge">Dockerfile</code> instructions: <code class="language-plaintext highlighter-rouge">CMD</code>|<code class="language-plaintext highlighter-rouge">ENTRYPOINT</code>|<code class="language-plaintext highlighter-rouge">ENV</code>|<code class="language-plaintext highlighter-rouge">EXPOSE</code>|<code class="language-plaintext highlighter-rouge">LABEL</code>|<code class="language-plaintext highlighter-rouge">ONBUILD</code>|<code class="language-plaintext highlighter-rouge">USER</code>|<code class="language-plaintext highlighter-rouge">VOLUME</code>|<code class="language-plaintext highlighter-rouge">WORKDIR</code></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">--author</code> , <code class="language-plaintext highlighter-rouge">-a</code>
+</td> <td></td> <td>Author (e.g., "John Hannibal Smith &lt;hannibal@a-team.com&gt;")</td> </tr> <tr> <td>
+<code class="language-plaintext highlighter-rouge">--change</code> , <code class="language-plaintext highlighter-rouge">-c</code>
+</td> <td></td> <td>Apply Dockerfile instruction to the created image</td> </tr> <tr> <td>
+<code class="language-plaintext highlighter-rouge">--message</code> , <code class="language-plaintext highlighter-rouge">-m</code>
+</td> <td></td> <td>Commit message</td> </tr> <tr> <td>
+<code class="language-plaintext highlighter-rouge">--pause</code> , <code class="language-plaintext highlighter-rouge">-p</code>
+</td> <td><code class="language-plaintext highlighter-rouge">true</code></td> <td>Pause container during commit</td> </tr> </tbody> </table> <h2 id="examples">Examples</h2> <h3 id="commit-a-container">Commit a container</h3> <div class="highlight"><pre class="highlight" data-language="">$ docker ps
+
+CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
+c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
+197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
+
+$ docker commit c3f279d17e0a svendowideit/testimage:version3
+
+f5283438590d
+
+$ docker images
+
+REPOSITORY TAG ID CREATED SIZE
+svendowideit/testimage version3 f5283438590d 16 seconds ago 335.7 MB
+</pre></div> <h3 id="commit-a-container-with-new-configurations">Commit a container with new configurations</h3> <div class="highlight"><pre class="highlight" data-language="">$ docker ps
+
+CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
+c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
+197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
+
+$ docker inspect -f "{{ .Config.Env }}" c3f279d17e0a
+
+[HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin]
+
+$ docker commit --change "ENV DEBUG=true" c3f279d17e0a svendowideit/testimage:version3
+
+f5283438590d
+
+$ docker inspect -f "{{ .Config.Env }}" f5283438590d
+
+[HOME=/ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin DEBUG=true]
+</pre></div> <h3 id="commit-a-container-with-new-cmd-and-expose-instructions">Commit a container with new <code class="language-plaintext highlighter-rouge">CMD</code> and <code class="language-plaintext highlighter-rouge">EXPOSE</code> instructions</h3> <div class="highlight"><pre class="highlight" data-language="">$ docker ps
+
+CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
+c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
+197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
+
+$ docker commit --change='CMD ["apachectl", "-DFOREGROUND"]' -c "EXPOSE 80" c3f279d17e0a svendowideit/testimage:version4
+
+f5283438590d
+
+$ docker run -d svendowideit/testimage:version4
+
+89373736e2e7f00bc149bd783073ac43d0507da250e999f3f1036e0db60817c0
+
+$ docker ps
+
+CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
+89373736e2e7 testimage:version4 "apachectl -DFOREGROU" 3 seconds ago Up 2 seconds 80/tcp distracted_fermat
+c3f279d17e0a ubuntu:12.04 /bin/bash 7 days ago Up 25 hours desperate_dubinsky
+197387f1b436 ubuntu:12.04 /bin/bash 7 days ago Up 25 hours focused_hamilton
+</pre></div> <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/commit/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/commit/</a>
+ </p>
+</div>