mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-10-09 23:43:29 +08:00
0.0.1
This commit is contained in:
13
docs/docker/docker attach.html
Normal file
13
docs/docker/docker attach.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<h1>Docker attach 命令</h1>
|
||||
<p><strong>docker attach :</strong>连接到正在运行中的容器。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker attach [OPTIONS] CONTAINER</pre>
|
||||
<p>要attach上去的容器必须正在运行,可以同时连接上同一个container来共享屏幕(与screen命令的attach类似)。</p><p>
|
||||
|
||||
官方文档中说attach后可以通过CTRL-C来detach,但实际上经过我的测试,如果container当前在运行bash,CTRL-C自然是当前行的输入,没有退出;如果container当前正在前台运行进程,如输出nginx的access.log日志,CTRL-C不仅会导致退出容器,而且还stop了。这不是我们想要的,detach的意思按理应该是脱离容器终端,但容器依然运行。好在attach是可以带上--sig-proxy=false来确保CTRL-D或CTRL-C不会关闭容器。</p>
|
||||
<h3>实例</h3>
|
||||
<p>容器mynginx将访问日志指到标准输出,连接到容器查看访问信息。</p>
|
||||
<pre>runoob@runoob:~$ docker attach --sig-proxy=false mynginx
|
||||
|
||||
192.168.239.1 - - [10/Jul/2016:16:54:26 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36" "-"
|
||||
</pre>
|
43
docs/docker/docker build.html
Normal file
43
docs/docker/docker build.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<h1>Docker build 命令</h1>
|
||||
<p><strong>docker build </strong> 命令用于使用 Dockerfile 创建镜像。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker build [OPTIONS] PATH | URL | -</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>--build-arg=[] :</strong>设置镜像创建时的变量;</p></li>
|
||||
<li><p><strong>--cpu-shares :</strong>设置 cpu 使用权重;</p></li>
|
||||
<li><p><strong>--cpu-period :</strong>限制 CPU CFS周期;</p></li>
|
||||
<li><p><strong>--cpu-quota :</strong>限制 CPU CFS配额;</p></li>
|
||||
<li><p><strong>--cpuset-cpus :</strong>指定使用的CPU id;</p></li>
|
||||
<li><p><strong>--cpuset-mems :</strong>指定使用的内存 id;</p></li>
|
||||
<li><p><strong>--disable-content-trust :</strong>忽略校验,默认开启;</p></li>
|
||||
<li><p><strong>-f :</strong>指定要使用的Dockerfile路径;</p></li>
|
||||
<li><p><strong>--force-rm :</strong>设置镜像过程中删除中间容器;</p></li>
|
||||
<li><p><strong>--isolation :</strong>使用容器隔离技术;</p></li>
|
||||
<li><p><strong>--label=[] :</strong>设置镜像使用的元数据;</p></li>
|
||||
<li><p><strong>-m :</strong>设置内存最大值;</p></li>
|
||||
<li><p><strong>--memory-swap :</strong>设置Swap的最大值为内存+swap,"-1"表示不限swap;</p></li>
|
||||
<li><p><strong>--no-cache :</strong>创建镜像的过程不使用缓存;</p></li>
|
||||
<li><p><strong>--pull :</strong>尝试去更新镜像的新版本;</p></li>
|
||||
<li><p><strong>--quiet, -q :</strong>安静模式,成功后只输出镜像 ID;</p></li>
|
||||
<li><p><strong>--rm :</strong>设置镜像成功后删除中间容器;</p></li>
|
||||
<li><p><strong>--shm-size :</strong>设置/dev/shm的大小,默认值是64M;</p></li>
|
||||
<li><p><strong>--ulimit :</strong>Ulimit配置。</p></li>
|
||||
<li><p><strong>--tag, -t:</strong> 镜像的名字及标签,通常 name:tag 或者 name 格式;可以在一次构建中为一个镜像设置多个标签。</p></li>
|
||||
<li><p><strong>--network:</strong> 默认 default。在构建期间设置RUN指令的网络模式</p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>使用当前目录的 Dockerfile 创建镜像,标签为 runoob/ubuntu:v1。</p>
|
||||
<pre>docker build -t runoob/ubuntu:v1 . </pre>
|
||||
<p>使用URL <strong>github.com/creack/docker-firefox</strong> 的 Dockerfile 创建镜像。
|
||||
|
||||
</p><pre>docker build github.com/creack/docker-firefox</pre>
|
||||
<p>也可以通过 -f Dockerfile 文件的位置:</p>
|
||||
<pre>$ docker build -f /path/to/a/Dockerfile .</pre>
|
||||
<p>在 Docker 守护进程执行 Dockerfile 中的指令前,首先会对 Dockerfile 进行语法检查,有语法错误时会返回:</p>
|
||||
<pre>$ docker build -t test/myapp .
|
||||
|
||||
Sending build context to Docker daemon 2.048 kB
|
||||
Error response from daemon: Unknown instruction: RUNCMD</pre>
|
||||
<p><a href="docker-command-manual.html"><img alt=" Docker 命令大全" class="navup" src="/images/up.gif"/>Docker 命令大全</a></p>
|
||||
<!-- 其他扩展 -->
|
24
docs/docker/docker commit.html
Normal file
24
docs/docker/docker commit.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<h1>Docker commit 命令</h1>
|
||||
<p><strong>docker commit :</strong>从容器创建一个新的镜像。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>-a :</strong>提交的镜像作者;</p><p></p></li>
|
||||
<li><p><strong>-c :</strong>使用Dockerfile指令来创建镜像;</p><p></p></li>
|
||||
<li><p><strong>-m :</strong>提交时的说明文字;</p><p></p></li>
|
||||
<li><p><strong>-p :</strong>在commit时,将容器暂停。</p><p></p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>将容器a404c6c174a2 保存为新的镜像,并添加提交人信息和说明信息。</p>
|
||||
<pre>runoob@runoob:~$ docker commit -a "runoob.com" -m "my apache" a404c6c174a2 mymysql:v1
|
||||
|
||||
sha256:37af1236adef1544e8886be23010b66577647a40bc02c0885a6600b33ee28057
|
||||
|
||||
runoob@runoob:~$ docker images mymysql:v1
|
||||
|
||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
|
||||
mymysql v1 37af1236adef 15 seconds ago 329 MB
|
||||
|
||||
</pre>
|
17
docs/docker/docker cp.html
Normal file
17
docs/docker/docker cp.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<h1>Docker cp 命令</h1>
|
||||
<p><strong>docker cp :</strong>用于容器与主机之间的数据拷贝。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-</pre>
|
||||
<pre>docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>-L :</strong>保持源目标中的链接</p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>将主机/www/runoob目录拷贝到容器96f7f14e99ab的/www目录下。</p>
|
||||
<pre>docker cp /www/runoob 96f7f14e99ab:/www/</pre>
|
||||
<p>将主机/www/runoob目录拷贝到容器96f7f14e99ab中,目录重命名为www。</p>
|
||||
<pre>docker cp /www/runoob 96f7f14e99ab:/www</pre>
|
||||
<p>将容器96f7f14e99ab的/www目录拷贝到主机的/tmp目录中。</p>
|
||||
<pre>docker cp 96f7f14e99ab:/www /tmp/</pre>
|
||||
<!-- 其他扩展 -->
|
12
docs/docker/docker create.html
Normal file
12
docs/docker/docker create.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<h1>Docker create 命令</h1>
|
||||
<p><strong>docker create :</strong>创建一个新的容器但不启动它</p>
|
||||
<p>用法同 <a href="docker-run-command.html">docker run</a></p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker create [OPTIONS] IMAGE [COMMAND] [ARG...]</pre>
|
||||
<p>语法同 <a href="docker-run-command.html">docker run</a></p>
|
||||
<h3>实例</h3>
|
||||
<p>使用docker镜像nginx:latest创建一个容器,并将容器命名为myrunoob</p>
|
||||
<pre>runoob@runoob:~$ docker create --name myrunoob nginx:latest
|
||||
|
||||
09b93464c2f75b7b69f83d56a9cfc23ceb50a48a9db7652ee4c27e3e2cb1961f
|
||||
|
24
docs/docker/docker diff.html
Normal file
24
docs/docker/docker diff.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<h1>Docker diff 命令</h1>
|
||||
<p><strong>docker diff : </strong>检查容器里文件结构的更改。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker diff [OPTIONS] CONTAINER</pre>
|
||||
<h3>实例</h3>
|
||||
<p>查看容器mymysql的文件结构更改。</p>
|
||||
<pre>runoob@runoob:~$ docker diff mymysql
|
||||
|
||||
A /logs
|
||||
|
||||
A /mysql_data
|
||||
|
||||
C /run
|
||||
|
||||
C /run/mysqld
|
||||
|
||||
|
||||
A /run/mysqld/mysqld.sock
|
||||
|
||||
C /tmp
|
||||
|
||||
</pre>
|
||||
<p><a href="docker-command-manual.html"><img alt=" Docker 命令大全" class="navup" src="/images/up.gif"/>Docker 命令大全</a></p>
|
||||
<!-- 其他扩展 -->
|
59
docs/docker/docker events.html
Normal file
59
docs/docker/docker events.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<h1>Docker events 命令</h1>
|
||||
<p><strong>docker events : </strong>从服务器获取实时事件</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker events [OPTIONS]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>-f :</strong>根据条件过滤事件;</p></li>
|
||||
<li><p><strong>--since :</strong>从指定的时间戳后显示所有事件;</p></li>
|
||||
<li><p><strong>--until :</strong>流水时间显示到指定的时间为止;</p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>显示docker 2016年7月1日后的所有事件。</p>
|
||||
<pre>runoob@runoob:~/mysql$ docker events --since="1467302400"
|
||||
|
||||
2016-07-08T19:44:54.501277677+08:00 network connect 66f958fd13dc4314ad20034e576d5c5eba72e0849dcc38ad9e8436314a4149d4 (container=b8573233d675705df8c89796a2c2687cd8e36e03646457a15fb51022db440e64, name=bridge, type=bridge)
|
||||
|
||||
2016-07-08T19:44:54.723876221+08:00 container start b8573233d675705df8c89796a2c2687cd8e36e03646457a15fb51022db440e64 (image=nginx:latest, name=elegant_albattani)
|
||||
|
||||
2016-07-08T19:44:54.726110498+08:00 container resize b8573233d675705df8c89796a2c2687cd8e36e03646457a15fb51022db440e64 (height=39, image=nginx:latest, name=elegant_albattani, width=167)
|
||||
|
||||
2016-07-08T19:46:22.137250899+08:00 container die b8573233d675705df8c89796a2c2687cd8e36e03646457a15fb51022db440e64 (exitCode=0, image=nginx:latest, name=elegant_albattani)
|
||||
|
||||
...
|
||||
|
||||
</pre>
|
||||
<p>显示docker 镜像为mysql:5.6 2016年7月1日后的相关事件。</p>
|
||||
<pre>runoob@runoob:~/mysql$ docker events -f "image"="mysql:5.6" --since="1467302400"
|
||||
|
||||
2016-07-11T00:38:53.975174837+08:00 container start 96f7f14e99ab9d2f60943a50be23035eda1623782cc5f930411bbea407a2bb10 (image=mysql:5.6, name=mymysql)
|
||||
|
||||
2016-07-11T00:51:17.022572452+08:00 container kill 96f7f14e99ab9d2f60943a50be23035eda1623782cc5f930411bbea407a2bb10 (image=mysql:5.6, name=mymysql, signal=9)
|
||||
|
||||
2016-07-11T00:51:17.132532080+08:00 container die 96f7f14e99ab9d2f60943a50be23035eda1623782cc5f930411bbea407a2bb10 (exitCode=137, image=mysql:5.6, name=mymysql)
|
||||
|
||||
2016-07-11T00:51:17.514661357+08:00 container destroy 96f7f14e99ab9d2f60943a50be23035eda1623782cc5f930411bbea407a2bb10 (image=mysql:5.6, name=mymysql)
|
||||
|
||||
2016-07-11T00:57:18.551984549+08:00 container create c8f0a32f12f5ec061d286af0b1285601a3e33a90a08ff1706de619ac823c345c (image=mysql:5.6, name=mymysql)
|
||||
|
||||
|
||||
2016-07-11T00:57:18.844134112+08:00 container start c8f0a32f12f5ec061d286af0b1285601a3e33a90a08ff1706de619ac823c345c (image=mysql:5.6, name=mymysql)
|
||||
|
||||
2016-07-11T00:57:19.140141428+08:00 container die c8f0a32f12f5ec061d286af0b1285601a3e33a90a08ff1706de619ac823c345c (exitCode=1, image=mysql:5.6, name=mymysql)
|
||||
|
||||
2016-07-11T00:58:05.941019136+08:00 container destroy c8f0a32f12f5ec061d286af0b1285601a3e33a90a08ff1706de619ac823c345c (image=mysql:5.6, name=mymysql)
|
||||
|
||||
2016-07-11T00:58:07.965128417+08:00 container create a404c6c174a21c52f199cfce476e041074ab020453c7df2a13a7869b48f2f37e (image=mysql:5.6, name=mymysql)
|
||||
|
||||
2016-07-11T00:58:08.188734598+08:00 container start a404c6c174a21c52f199cfce476e041074ab020453c7df2a13a7869b48f2f37e (image=mysql:5.6, name=mymysql)
|
||||
|
||||
2016-07-11T00:58:20.010876777+08:00 container top a404c6c174a21c52f199cfce476e041074ab020453c7df2a13a7869b48f2f37e (image=mysql:5.6, name=mymysql)
|
||||
|
||||
2016-07-11T01:06:01.395365098+08:00 container top a404c6c174a21c52f199cfce476e041074ab020453c7df2a13a7869b48f2f37e (image=mysql:5.6, name=mymysql)
|
||||
|
||||
|
||||
|
||||
</pre>
|
||||
<p>如果指定的时间是到秒级的,需要将时间转成时间戳。如果时间为日期的话,可以直接使用,如--since="2016-07-01"。</p><p>
|
||||
</p><p><a href="docker-command-manual.html"><img alt=" Docker 命令大全" class="navup" src="/images/up.gif"/>Docker 命令大全</a></p>
|
||||
<!-- 其他扩展 -->
|
24
docs/docker/docker exec.html
Normal file
24
docs/docker/docker exec.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<h1>Docker exec 命令</h1>
|
||||
<p><strong>docker exec :</strong>在运行的容器中执行命令</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker exec [OPTIONS] CONTAINER COMMAND [ARG...]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul><li>
|
||||
<p><strong>-d :</strong>分离模式: 在后台运行</p></li><li>
|
||||
<p><strong>-i :</strong>即使没有附加也保持STDIN 打开</p></li><li>
|
||||
<p><strong>-t :</strong>分配一个伪终端</p>
|
||||
</li></ul>
|
||||
<h3>实例</h3>
|
||||
<p>在容器mynginx中以交互模式执行容器内/root/runoob.sh脚本</p><p>
|
||||
</p><pre>runoob@runoob:~$ docker exec -it mynginx /bin/sh /root/runoob.sh
|
||||
|
||||
http://www.runoob.com/
|
||||
|
||||
</pre>
|
||||
<p>在容器mynginx中开启一个交互模式的终端</p>
|
||||
<pre>runoob@runoob:~$ docker exec -i -t mynginx /bin/bash
|
||||
|
||||
|
||||
</pre>
|
||||
<p><a href="docker-command-manual.html"><img alt=" Docker 命令大全" class="navup" src="/images/up.gif"/>Docker 命令大全</a></p>
|
||||
<!-- 其他扩展 -->
|
16
docs/docker/docker export.html
Normal file
16
docs/docker/docker export.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<h1>Docker export 命令</h1>
|
||||
<p><strong>docker export :</strong>将文件系统作为一个tar归档文件导出到STDOUT。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker export [OPTIONS] CONTAINER</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>-o :</strong>将输入内容写到文件。</p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>将id为a404c6c174a2的容器按日期保存为tar文件。</p>
|
||||
<pre>runoob@runoob:~$ docker export -o mysql-`date +%Y%m%d`.tar a404c6c174a2
|
||||
|
||||
runoob@runoob:~$ ls mysql-`date +%Y%m%d`.tar
|
||||
|
||||
mysql-20160711.tar
|
||||
</pre>
|
26
docs/docker/docker history.html
Normal file
26
docs/docker/docker history.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<h1>Docker history 命令</h1>
|
||||
<p><strong>docker history : </strong>查看指定镜像的创建历史。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker history [OPTIONS] IMAGE</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>-H :</strong>以可读的格式打印镜像大小和日期,默认为true;</p><p></p></li>
|
||||
<li><p><strong>--no-trunc :</strong>显示完整的提交记录;</p><p></p></li>
|
||||
<li><p><strong>-q :</strong>仅列出提交记录ID。</p><p></p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>查看本地镜像runoob/ubuntu:v3的创建历史。</p>
|
||||
<pre>
|
||||
|
||||
root@runoob:~# docker history runoob/ubuntu:v3
|
||||
|
||||
IMAGE CREATED CREATED BY SIZE COMMENT
|
||||
|
||||
4e3b13c8a266 3 months ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B
|
||||
|
||||
<missing> 3 months ago /bin/sh -c sed -i 's/^#\s*\(deb.*universe\)$/ 1.863 kB
|
||||
<missing> 3 months ago /bin/sh -c set -xe && echo '#!/bin/sh' > /u 701 B
|
||||
|
||||
<missing> 3 months ago /bin/sh -c #(nop) ADD file:43cb048516c6b80f22 136.3 MB
|
||||
|
||||
</pre>
|
49
docs/docker/docker images.html
Normal file
49
docs/docker/docker images.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<h1>Docker images 命令</h1>
|
||||
<p><strong>docker images : </strong>列出本地镜像。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker images [OPTIONS] [REPOSITORY[:TAG]]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>-a :</strong>列出本地所有的镜像(含中间映像层,默认情况下,过滤掉中间映像层);</p><p></p></li>
|
||||
<li><p><strong>--digests :</strong>显示镜像的摘要信息;</p><p></p></li>
|
||||
<li><p><strong>-f :</strong>显示满足条件的镜像;</p><p></p></li>
|
||||
<li><p><strong>--format :</strong>指定返回值的模板文件;</p><p></p></li>
|
||||
<li><p><strong>--no-trunc :</strong>显示完整的镜像信息;</p><p></p></li>
|
||||
<li><p><strong>-q :</strong>只显示镜像ID。</p><p></p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>查看本地镜像列表。</p>
|
||||
<pre>runoob@runoob:~$ docker images
|
||||
|
||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
|
||||
mymysql v1 37af1236adef 5 minutes ago 329 MB
|
||||
|
||||
runoob/ubuntu v4 1c06aa18edee 2 days ago 142.1 MB
|
||||
|
||||
<none> <none> 5c6e1090e771 2 days ago 165.9 MB
|
||||
|
||||
httpd latest ed38aaffef30 11 days ago 195.1 MB
|
||||
|
||||
alpine latest 4e38e38c8ce0 2 weeks ago 4.799 MB
|
||||
|
||||
mongo 3.2 282fd552add6 3 weeks ago 336.1 MB
|
||||
|
||||
redis latest 4465e4bcad80 3 weeks ago 185.7 MB
|
||||
|
||||
php 5.6-fpm 025041cd3aa5 3 weeks ago 456.3 MB
|
||||
|
||||
|
||||
...
|
||||
|
||||
</pre>
|
||||
<p>列出本地镜像中REPOSITORY为ubuntu的镜像列表。</p>
|
||||
<pre>root@runoob:~# docker images ubuntu
|
||||
|
||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
|
||||
ubuntu 14.04 90d5884b1ee0 9 weeks ago 188 MB
|
||||
|
||||
ubuntu 15.10 4e3b13c8a266 3 months ago 136.3 MB
|
||||
|
||||
</pre>
|
23
docs/docker/docker import.html
Normal file
23
docs/docker/docker import.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<h1>Docker import 命令</h1>
|
||||
<p><strong>docker import :</strong> 从归档文件中创建镜像。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker import [OPTIONS] file|URL|- [REPOSITORY[:TAG]]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>-c :</strong>应用docker 指令创建镜像;</p><p></p></li>
|
||||
<li><p><strong>-m :</strong>提交时的说明文字;</p><p></p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>从镜像归档文件my_ubuntu_v3.tar创建镜像,命名为runoob/ubuntu:v4</p>
|
||||
<pre>runoob@runoob:~$ docker import my_ubuntu_v3.tar runoob/ubuntu:v4
|
||||
|
||||
sha256:63ce4a6d6bc3fabb95dbd6c561404a309b7bdfc4e21c1d59fe9fe4299cbfea39
|
||||
|
||||
runoob@runoob:~$ docker images runoob/ubuntu:v4
|
||||
|
||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
runoob/ubuntu v4 63ce4a6d6bc3 20 seconds ago 142.1 MB
|
||||
|
||||
</pre>
|
||||
<p><a href="docker-command-manual.html"><img alt=" Docker 命令大全" class="navup" src="/images/up.gif"/>Docker 命令大全</a></p>
|
||||
<!-- 其他扩展 -->
|
40
docs/docker/docker info.html
Normal file
40
docs/docker/docker info.html
Normal file
@@ -0,0 +1,40 @@
|
||||
<h1>Docker info 命令</h1>
|
||||
<p>docker info : 显示 Docker 系统信息,包括镜像和容器数。。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker info [OPTIONS]</pre>
|
||||
<h3>实例</h3>
|
||||
<p>查看docker系统信息。</p>
|
||||
<pre>$ docker info
|
||||
|
||||
Containers: 12
|
||||
|
||||
Images: 41
|
||||
|
||||
Storage Driver: aufs
|
||||
|
||||
Root Dir: /var/lib/docker/aufs
|
||||
|
||||
Backing Filesystem: extfs
|
||||
|
||||
Dirs: 66
|
||||
|
||||
Dirperm1 Supported: false
|
||||
|
||||
Execution Driver: native-0.2
|
||||
|
||||
|
||||
Kernel Version: 3.13.0-32-generic
|
||||
|
||||
Operating System: Ubuntu 14.04.1 LTS
|
||||
|
||||
CPUs: 1
|
||||
|
||||
Total Memory: 1.954 GiB
|
||||
|
||||
Name: iZ23mtq8bs1Z
|
||||
|
||||
ID: M5N4:K6WN:PUNC:73ZN:AONJ:AUHL:KSYH:2JPI:CH3K:O4MK:6OCX:5OYW
|
||||
|
||||
</pre>
|
||||
<p><a href="docker-command-manual.html"><img alt=" Docker 命令大全" class="navup" src="/images/up.gif"/>Docker 命令大全</a></p>
|
||||
<!-- 其他扩展 -->
|
66
docs/docker/docker inspect.html
Normal file
66
docs/docker/docker inspect.html
Normal file
@@ -0,0 +1,66 @@
|
||||
<h1>Docker inspect 命令</h1>
|
||||
<p><strong>docker inspect :</strong> 获取容器/镜像的元数据。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker inspect [OPTIONS] NAME|ID [NAME|ID...]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>-f :</strong>指定返回值的模板文件。</p></li>
|
||||
<li><p><strong>-s :</strong>显示总的文件大小。</p></li>
|
||||
<li><p><strong>--type :</strong>为指定类型返回JSON。</p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>获取镜像mysql:5.6的元信息。</p>
|
||||
<pre>runoob@runoob:~$ docker inspect mysql:5.6
|
||||
|
||||
[
|
||||
|
||||
{
|
||||
|
||||
"Id": "sha256:2c0964ec182ae9a045f866bbc2553087f6e42bfc16074a74fb820af235f070ec",
|
||||
|
||||
"RepoTags": [
|
||||
|
||||
"mysql:5.6"
|
||||
|
||||
],
|
||||
|
||||
"RepoDigests": [],
|
||||
|
||||
"Parent": "",
|
||||
|
||||
"Comment": "",
|
||||
|
||||
"Created": "2016-05-24T04:01:41.168371815Z",
|
||||
|
||||
"Container": "e0924bc460ff97787f34610115e9363e6363b30b8efa406e28eb495ab199ca54",
|
||||
|
||||
"ContainerConfig": {
|
||||
|
||||
"Hostname": "b0cf605c7757",
|
||||
|
||||
"Domainname": "",
|
||||
"User": "",
|
||||
|
||||
"AttachStdin": false,
|
||||
|
||||
"AttachStdout": false,
|
||||
|
||||
"AttachStderr": false,
|
||||
|
||||
"ExposedPorts": {
|
||||
|
||||
"3306/tcp": {}
|
||||
|
||||
},
|
||||
|
||||
...
|
||||
|
||||
</pre>
|
||||
<p>获取正在运行的容器mymysql的 IP。 </p>
|
||||
<pre>runoob@runoob:~$ docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mymysql
|
||||
|
||||
172.17.0.3
|
||||
|
||||
</pre>
|
||||
<p><a href="docker-command-manual.html"><img alt=" Docker 命令大全" class="navup" src="/images/up.gif"/>Docker 命令大全</a></p>
|
||||
<!-- 其他扩展 -->
|
16
docs/docker/docker kill.html
Normal file
16
docs/docker/docker kill.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<h1>Docker kill 命令</h1>
|
||||
<p><strong>docker kill</strong> :杀掉一个运行中的容器。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker kill [OPTIONS] CONTAINER [CONTAINER...]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul><li>
|
||||
<p><strong>-s :</strong>向容器发送一个信号</p>
|
||||
</li></ul>
|
||||
<h3>实例</h3>
|
||||
<p>杀掉运行中的容器mynginx</p>
|
||||
<pre>runoob@runoob:~$ docker kill -s KILL mynginx
|
||||
|
||||
mynginx
|
||||
|
||||
<p><a href="docker-command-manual.html"><img alt=" Docker 命令大全" class="navup" src="/images/up.gif"/>Docker 命令大全</a></p>
|
||||
<!-- 其他扩展 -->
|
17
docs/docker/docker login.html
Normal file
17
docs/docker/docker login.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<h1>Docker login/logout 命令</h1>
|
||||
<p><strong>docker login :</strong> 登陆到一个Docker镜像仓库,如果未指定镜像仓库地址,默认为官方仓库 Docker Hub</p>
|
||||
<p><strong>docker logout :</strong> 登出一个Docker镜像仓库,如果未指定镜像仓库地址,默认为官方仓库 Docker Hub</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker login [OPTIONS] [SERVER]</pre>
|
||||
<pre>docker logout [OPTIONS] [SERVER]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>-u :</strong>登陆的用户名</p></li>
|
||||
<li><p><strong>-p :</strong>登陆的密码</p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>登陆到Docker Hub</p>
|
||||
<pre>docker login -u 用户名 -p 密码</pre>
|
||||
<p>登出Docker Hub</p>
|
||||
<pre>docker logout</pre>
|
||||
<!-- 其他扩展 -->
|
29
docs/docker/docker logs.html
Normal file
29
docs/docker/docker logs.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<h1>Docker logs 命令</h1>
|
||||
<p><strong>docker logs : </strong>获取容器的日志</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker logs [OPTIONS] CONTAINER</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>-f : </strong>跟踪日志输出</p></li>
|
||||
<li><p><strong>--since :</strong>显示某个开始时间的所有日志</p></li>
|
||||
<li><p><strong>-t : </strong>显示时间戳</p></li>
|
||||
<li><p><strong>--tail :</strong>仅列出最新N条容器日志</p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>跟踪查看容器mynginx的日志输出。</p>
|
||||
<pre>runoob@runoob:~$ docker logs -f mynginx
|
||||
|
||||
192.168.239.1 - - [10/Jul/2016:16:53:33 +0000] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36" "-"
|
||||
|
||||
2016/07/10 16:53:33 [error] 5#5: *1 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 192.168.239.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "192.168.239.130", referrer: "http://192.168.239.130/"
|
||||
|
||||
192.168.239.1 - - [10/Jul/2016:16:53:33 +0000] "GET /favicon.ico HTTP/1.1" 404 571 "http://192.168.239.130/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36" "-"
|
||||
|
||||
192.168.239.1 - - [10/Jul/2016:16:53:59 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36" "-"
|
||||
|
||||
...
|
||||
|
||||
|
||||
</pre>
|
||||
<p>查看容器mynginx从2016年7月1日后的最新10条日志。</p>
|
||||
<pre>docker logs --since="2016-07-01" --tail=10 mynginx</pre>
|
12
docs/docker/docker pause unpause.html
Normal file
12
docs/docker/docker pause unpause.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<h1>Docker pause/unpause 命令</h1>
|
||||
<p><strong>docker pause</strong> :暂停容器中所有的进程。</p>
|
||||
<p><strong>docker unpause</strong> :恢复容器中所有的进程。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker pause [OPTIONS] CONTAINER [CONTAINER...]</pre>
|
||||
<pre>docker unpause [OPTIONS] CONTAINER [CONTAINER...]</pre>
|
||||
<h3>实例</h3>
|
||||
<p>暂停数据库容器db01提供服务。</p>
|
||||
<pre>docker pause db01</pre>
|
||||
<p>恢复数据库容器db01提供服务。</p>
|
||||
<pre>docker unpause db01</pre>
|
||||
<!-- 其他扩展 -->
|
10
docs/docker/docker port.html
Normal file
10
docs/docker/docker port.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<h1>Docker port 命令</h1>
|
||||
<p><strong>docker port :</strong>列出指定的容器的端口映射,或者查找将PRIVATE_PORT NAT到面向公众的端口。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker port [OPTIONS] CONTAINER [PRIVATE_PORT[/PROTO]]</pre>
|
||||
<h3>实例</h3>
|
||||
<p>查看容器mynginx的端口映射情况。</p>
|
||||
<pre>runoob@runoob:~$ docker port mymysql
|
||||
|
||||
3306/tcp -> 0.0.0.0:3306
|
||||
|
69
docs/docker/docker ps.html
Normal file
69
docs/docker/docker ps.html
Normal file
@@ -0,0 +1,69 @@
|
||||
<h1>Docker ps 命令</h1>
|
||||
<p><strong>docker ps : </strong>列出容器</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker ps [OPTIONS]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>-a :</strong>显示所有的容器,包括未运行的。</p></li>
|
||||
<li><p><strong>-f :</strong>根据条件过滤显示的内容。</p><p></p></li>
|
||||
<li><p><strong>--format :</strong>指定返回值的模板文件。</p></li>
|
||||
<li><p><strong>-l :</strong>显示最近创建的容器。</p></li>
|
||||
<li><p><strong>-n :</strong>列出最近创建的n个容器。</p></li>
|
||||
<li><p><strong>--no-trunc :</strong>不截断输出。</p></li>
|
||||
<li><p><strong>-q :</strong>静默模式,只显示容器编号。</p></li>
|
||||
<li><p><strong>-s :</strong>显示总的文件大小。</p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>列出所有在运行的容器信息。</p>
|
||||
<pre>runoob@runoob:~$ docker ps
|
||||
|
||||
CONTAINER ID IMAGE COMMAND ... PORTS NAMES
|
||||
|
||||
09b93464c2f7 nginx:latest "nginx -g 'daemon off" ... 80/tcp, 443/tcp myrunoob
|
||||
|
||||
96f7f14e99ab mysql:5.6 "docker-entrypoint.sh" ... 0.0.0.0:3306->3306/tcp mymysql
|
||||
|
||||
</pre>
|
||||
<p>列出最近创建的5个容器信息。</p>
|
||||
<pre>runoob@runoob:~$ docker ps -n 5
|
||||
|
||||
CONTAINER ID IMAGE COMMAND CREATED
|
||||
|
||||
09b93464c2f7 nginx:latest "nginx -g 'daemon off" 2 days ago ...
|
||||
|
||||
b8573233d675 nginx:latest "/bin/bash" 2 days ago ...
|
||||
|
||||
b1a0703e41e7 nginx:latest "nginx -g 'daemon off" 2 days ago ...
|
||||
|
||||
f46fb1dec520 5c6e1090e771 "/bin/sh -c 'set -x \t" 2 days ago ...
|
||||
|
||||
a63b4a5597de 860c279d2fec "bash" 2 days ago ...
|
||||
|
||||
</pre>
|
||||
<p>列出所有创建的容器ID。</p>
|
||||
<pre>runoob@runoob:~$ docker ps -a -q
|
||||
|
||||
09b93464c2f7
|
||||
b8573233d675
|
||||
|
||||
b1a0703e41e7
|
||||
|
||||
f46fb1dec520
|
||||
|
||||
a63b4a5597de
|
||||
|
||||
6a4aa42e947b
|
||||
|
||||
de7bb36e7968
|
||||
|
||||
43a432b73776
|
||||
|
||||
664a8ab1a585
|
||||
|
||||
ba52eb632bbd
|
||||
|
||||
...
|
||||
|
||||
</pre>
|
||||
<p><a href="docker-command-manual.html"><img alt=" Docker 命令大全" class="navup" src="/images/up.gif"/>Docker 命令大全</a></p>
|
||||
<!-- 其他扩展 -->
|
15
docs/docker/docker pull.html
Normal file
15
docs/docker/docker pull.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<h1>Docker pull 命令</h1>
|
||||
<p><strong>docker pull : </strong>从镜像仓库中拉取或者更新指定镜像</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker pull [OPTIONS] NAME[:TAG|@DIGEST]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>-a :</strong>拉取所有 tagged 镜像</p><p></p></li>
|
||||
<li><p><strong>--disable-content-trust :</strong>忽略镜像的校验,默认开启</p><p></p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>从Docker Hub下载java最新版镜像。</p>
|
||||
<pre>docker pull java</pre>
|
||||
<p>从Docker Hub下载REPOSITORY为java的所有镜像。</p>
|
||||
<pre>docker pull -a java</pre>
|
||||
<!-- 其他扩展 -->
|
12
docs/docker/docker push.html
Normal file
12
docs/docker/docker push.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<h1>Docker push 命令</h1>
|
||||
<p><strong>docker push : </strong>将本地的镜像上传到镜像仓库,要先登陆到镜像仓库</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker push [OPTIONS] NAME[:TAG]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>--disable-content-trust :</strong>忽略镜像的校验,默认开启</p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>上传本地镜像myapache:v1到镜像仓库中。</p>
|
||||
<pre>docker push myapache:v1</pre>
|
||||
<!-- 其他扩展 -->
|
17
docs/docker/docker rm.html
Normal file
17
docs/docker/docker rm.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<h1>Docker rm 命令</h1>
|
||||
<p><strong>docker rm :</strong>删除一个或多少容器</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker rm [OPTIONS] CONTAINER [CONTAINER...]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul><li>
|
||||
<p><strong>-f :</strong>通过SIGKILL信号强制删除一个运行中的容器</p></li><li>
|
||||
<p><strong>-l :</strong>移除容器间的网络连接,而非容器本身</p></li><li>
|
||||
<p><strong>-v :</strong>-v 删除与容器关联的卷</p>
|
||||
</li></ul>
|
||||
<h3>实例</h3>
|
||||
<p>强制删除容器db01、db02</p>
|
||||
<pre>docker rm -f db01 db02</pre>
|
||||
<p>移除容器nginx01对容器db01的连接,连接名db</p>
|
||||
<pre>docker rm -l db </pre>
|
||||
<p>删除容器nginx01,并删除容器挂载的数据卷</p>
|
||||
<pre>docker rm -v nginx01</pre>
|
19
docs/docker/docker rmi.html
Normal file
19
docs/docker/docker rmi.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<h1>Docker rmi 命令</h1>
|
||||
<p><strong>docker rmi : </strong>删除本地一个或多少镜像。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker rmi [OPTIONS] IMAGE [IMAGE...]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>-f :</strong>强制删除;</p><p></p></li>
|
||||
<li><p><strong>--no-prune :</strong>不移除该镜像的过程镜像,默认移除;</p><p></p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>强制删除本地镜像runoob/ubuntu:v4。</p>
|
||||
<pre>root@runoob:~# docker rmi -f runoob/ubuntu:v4
|
||||
|
||||
Untagged: runoob/ubuntu:v4
|
||||
|
||||
Deleted: sha256:1c06aa18edee44230f93a90a7d88139235de12cd4c089d41eed8419b503072be
|
||||
|
||||
|
||||
</pre>
|
56
docs/docker/docker run.html
Normal file
56
docs/docker/docker run.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<h1>Docker run 命令</h1>
|
||||
<p><strong>docker run :</strong>创建一个新的容器并运行一个命令</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker run [OPTIONS] IMAGE [COMMAND] [ARG...]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul><li>
|
||||
<p><strong>-a stdin:</strong> 指定标准输入输出内容类型,可选 STDIN/STDOUT/STDERR 三项;</p>
|
||||
</li><li>
|
||||
<p><strong>-d:</strong> 后台运行容器,并返回容器ID;</p>
|
||||
</li><li>
|
||||
<p><strong>-i:</strong> 以交互模式运行容器,通常与 -t 同时使用;</p>
|
||||
</li>
|
||||
<li><p><strong>-p:</strong> 端口映射,格式为:<span class="marked">主机(宿主)端口:容器端口 </span></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><strong>-t:</strong> 为容器重新分配一个伪输入终端,通常与 -i 同时使用;</p>
|
||||
</li><li>
|
||||
<p><strong>--name="nginx-lb":</strong> 为容器指定一个名称;</p>
|
||||
</li><li>
|
||||
<p><strong>--dns 8.8.8.8:</strong> 指定容器使用的DNS服务器,默认和宿主一致;</p>
|
||||
</li><li>
|
||||
<p><strong>--dns-search example.com:</strong> 指定容器DNS搜索域名,默认和宿主一致;</p>
|
||||
</li><li>
|
||||
<p><strong>-h "mars":</strong> 指定容器的hostname;</p>
|
||||
</li><li>
|
||||
<p><strong>-e username="ritchie":</strong> 设置环境变量;</p>
|
||||
</li><li>
|
||||
<p><strong>--env-file=[]:</strong> 从指定文件读入环境变量;</p>
|
||||
</li><li>
|
||||
<p><strong>--cpuset="0-2" or --cpuset="0,1,2":</strong> 绑定容器到指定CPU运行;</p>
|
||||
</li><li>
|
||||
<p><strong>-m :</strong>设置容器使用内存最大值;</p>
|
||||
</li><li>
|
||||
<p><strong>--net="bridge":</strong> 指定容器的网络连接类型,支持 bridge/host/none/container:<name> 四种类型;</name></p>
|
||||
</li><li>
|
||||
<p><strong>--link=[]:</strong> 添加链接到另一个容器;</p>
|
||||
</li><li>
|
||||
<p><strong>--expose=[]:</strong> 开放一个端口或一组端口;
|
||||
|
||||
</p></li></ul>
|
||||
<h3>实例</h3>
|
||||
<p>使用docker镜像nginx:latest以后台模式启动一个容器,并将容器命名为mynginx。</p>
|
||||
<pre>docker run --name mynginx -d nginx:latest</pre>
|
||||
<p>使用镜像nginx:latest以后台模式启动一个容器,并将容器的80端口映射到主机随机端口。</p>
|
||||
<pre>docker run -P -d nginx:latest</pre>
|
||||
<p>使用镜像 nginx:latest,以后台模式启动一个容器,将容器的 80 端口映射到主机的 80 端口,主机的目录 /data 映射到容器的 /data。</p>
|
||||
<pre>docker run -p 80:80 -v /data:/data -d nginx:latest</pre>
|
||||
<p>绑定容器的 8080 端口,并将其映射到本地主机 127.0.0.1 的 80 端口上。</p>
|
||||
<pre>$ docker run -p 127.0.0.1:80:8080/tcp ubuntu bash</pre>
|
||||
<p>使用镜像nginx:latest以交互模式启动一个容器,在容器内执行/bin/bash命令。</p>
|
||||
<pre>runoob@runoob:~$ docker run -it nginx:latest /bin/bash
|
||||
|
||||
root@b8573233d675:/#
|
||||
</pre>
|
||||
<p><a href="docker-command-manual.html"><img alt=" Docker 命令大全" class="navup" src="/images/up.gif"/>Docker 命令大全</a></p>
|
||||
<!-- 其他扩展 -->
|
16
docs/docker/docker save.html
Normal file
16
docs/docker/docker save.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<h1>Docker save 命令</h1>
|
||||
<p><strong>docker save : </strong>将指定镜像保存成 tar 归档文件。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker save [OPTIONS] IMAGE [IMAGE...]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>-o :</strong>输出到的文件。</p><p></p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>将镜像runoob/ubuntu:v3 生成my_ubuntu_v3.tar文档</p>
|
||||
<pre>runoob@runoob:~$ docker save -o my_ubuntu_v3.tar runoob/ubuntu:v3
|
||||
|
||||
runoob@runoob:~$ ll my_ubuntu_v3.tar
|
||||
|
||||
-rw------- 1 runoob runoob 142102016 Jul 11 01:37 my_ubuntu_v3.ta
|
||||
</pre>
|
28
docs/docker/docker search.html
Normal file
28
docs/docker/docker search.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<h1>Docker search 命令</h1>
|
||||
<p><strong>docker search :</strong> 从Docker Hub查找镜像</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker search [OPTIONS] TERM</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>--automated :</strong>只列出 automated build类型的镜像;</p></li>
|
||||
<li><p><strong>--no-trunc :</strong>显示完整的镜像描述;</p></li>
|
||||
<li><p><strong>-s :</strong>列出收藏数不小于指定值的镜像。</p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>从Docker Hub查找所有镜像名包含java,并且收藏数大于10的镜像</p>
|
||||
<pre>runoob@runoob:~$ docker search -s 10 java
|
||||
|
||||
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
|
||||
|
||||
java Java is a concurrent, class-based... 1037 [OK]
|
||||
|
||||
anapsix/alpine-java Oracle Java 8 (and 7) with GLIBC ... 115 [OK]
|
||||
|
||||
develar/java 46 [OK]
|
||||
|
||||
|
||||
lwieske/java-8 Oracle Java 8 Container - Full + ... 27 [OK]
|
||||
|
||||
nimmis/java-centos This is docker images of CentOS 7... 13 [OK]
|
||||
|
||||
</pre>
|
15
docs/docker/docker start stop restart.html
Normal file
15
docs/docker/docker start stop restart.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<h1>Docker start/stop/restart 命令</h1>
|
||||
<p><strong>docker start</strong> :启动一个或多个已经被停止的容器</p>
|
||||
<p><strong>docker stop</strong> :停止一个运行中的容器</p>
|
||||
<p><strong>docker restart</strong> :重启容器</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker start [OPTIONS] CONTAINER [CONTAINER...]</pre>
|
||||
<pre>docker stop [OPTIONS] CONTAINER [CONTAINER...]</pre>
|
||||
<pre>docker restart [OPTIONS] CONTAINER [CONTAINER...]</pre>
|
||||
<h3>实例</h3>
|
||||
<p>启动已被停止的容器myrunoob</p>
|
||||
<pre>docker start myrunoob</pre>
|
||||
<p>停止运行中的容器myrunoob</p>
|
||||
<pre>docker stop myrunoob</pre>
|
||||
<p>重启容器myrunoob</p>
|
||||
<pre>docker restart myrunoob</pre>
|
14
docs/docker/docker tag.html
Normal file
14
docs/docker/docker tag.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<h1>Docker tag 命令</h1>
|
||||
<p><strong>docker tag : </strong>标记本地镜像,将其归入某一仓库。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]</pre>
|
||||
<h3>实例</h3>
|
||||
<p>将镜像ubuntu:15.10标记为 runoob/ubuntu:v3 镜像。</p>
|
||||
<pre>root@runoob:~# docker tag ubuntu:15.10 runoob/ubuntu:v3
|
||||
|
||||
root@runoob:~# docker images runoob/ubuntu:v3
|
||||
|
||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
|
||||
|
||||
</pre>
|
17
docs/docker/docker top.html
Normal file
17
docs/docker/docker top.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<h1>Docker top 命令</h1>
|
||||
<p><strong>docker top :</strong>查看容器中运行的进程信息,支持 ps 命令参数。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker top [OPTIONS] CONTAINER [ps OPTIONS]</pre>
|
||||
<p>容器运行时不一定有/bin/bash终端来交互执行top命令,而且容器还不一定有top命令,可以使用docker top来实现查看container中正在运行的进程。</p>
|
||||
<h3>实例</h3>
|
||||
<p>查看容器mymysql的进程信息。</p>
|
||||
<pre>runoob@runoob:~/mysql$ docker top mymysql
|
||||
|
||||
UID PID PPID C STIME TTY TIME CMD
|
||||
|
||||
999 40347 40331 18 00:58 ? 00:00:02 mysqld
|
||||
|
||||
</pre>
|
||||
<pre>for i in `docker ps |grep Up|awk '{print $1}'`;do echo \ &&docker top $i; done</pre>
|
||||
<p><a href="docker-command-manual.html"><img alt=" Docker 命令大全" class="navup" src="/images/up.gif"/>Docker 命令大全</a></p>
|
||||
<!-- 其他扩展 -->
|
44
docs/docker/docker version.html
Normal file
44
docs/docker/docker version.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<h1>Docker version 命令</h1>
|
||||
<p>docker version :显示 Docker 版本信息。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker version [OPTIONS]</pre>
|
||||
<p>OPTIONS说明:</p>
|
||||
<ul>
|
||||
<li><p><strong>-f :</strong>指定返回值的模板文件。</p><p></p></li>
|
||||
</ul>
|
||||
<h3>实例</h3>
|
||||
<p>显示 Docker 版本信息。</p>
|
||||
<pre>$ docker version
|
||||
|
||||
Client:
|
||||
|
||||
Version: 1.8.2
|
||||
|
||||
API version: 1.20
|
||||
|
||||
Go version: go1.4.2
|
||||
|
||||
Git commit: 0a8c2e3
|
||||
|
||||
Built: Thu Sep 10 19:19:00 UTC 2015
|
||||
|
||||
OS/Arch: linux/amd64
|
||||
|
||||
|
||||
|
||||
|
||||
Version: 1.8.2
|
||||
|
||||
API version: 1.20
|
||||
|
||||
Go version: go1.4.2
|
||||
|
||||
Git commit: 0a8c2e3
|
||||
|
||||
Built: Thu Sep 10 19:19:00 UTC 2015
|
||||
|
||||
OS/Arch: linux/amd64
|
||||
|
||||
</pre>
|
||||
<p><a href="docker-command-manual.html"><img alt=" Docker 命令大全" class="navup" src="/images/up.gif"/>Docker 命令大全</a></p>
|
||||
<!-- 其他扩展 -->
|
7
docs/docker/docker wait.html
Normal file
7
docs/docker/docker wait.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<h1>Docker wait 命令</h1>
|
||||
<p><strong>docker wait :</strong> 阻塞运行直到容器停止,然后打印出它的退出代码。</p>
|
||||
<h3>语法</h3>
|
||||
<pre>docker wait [OPTIONS] CONTAINER [CONTAINER...]</pre>
|
||||
<h3>实例</h3>
|
||||
<pre>docker wait CONTAINER</pre>
|
||||
<!-- 其他扩展 -->
|
Reference in New Issue
Block a user