docker修改command_docker 命令详解

docker attach  attach到一个运行中的容器

[root@localhost ~]# docker attach --help        //docker attach帮助

Usage: docker attach [OPTIONS] CONTAINER

Attach to a running container

--help=false        Print usage

--no-stdin=false    Do not attach STDIN

--sig-proxy=true    Proxy all received signals to the process

[root@localhost ~]# docker ps  //查看运行中的docker

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

[root@localhost ~]# docker run -d -t -i --name centostest centos:latest  运行名“centos:latest”镜像启动名为“centostest”容器

1ebe9c55d4692f39917f3c78cfed30573aa6f02e51b618274d0b39f090c9b91e

[root@localhost ~]# docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

1ebe9c55d469        centos:latest       "/bin/bash"         40 seconds ago      Up 38 seconds                           centostest

[root@localhost ~]#

[root@localhost ~]# docker attach centostest     //attach 到容器centostest中

[root@1ebe9c55d469 /]# 先按ctrl + p 在按 ctrl+q  //退出容器,容器继续运行

[root@localhost ~]# docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

1ebe9c55d469        centos:latest       "/bin/bash"         54 minutes ago      Up 53 minutes                           centostest

[root@localhost ~]# docker attach centostest

[root@1ebe9c55d469 home]#

[root@1ebe9c55d469 home]# exit    //退出容器,容器停止运行

exit

[root@localhost ~]#

[root@localhost ~]# docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

[root@localhost ~]#

[root@localhost ~]# docker ps -a

CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS                           PORTS               NAMES

1ebe9c55d469        centos:latest             "/bin/bash"            57 minutes ago      Exited (0) 52 seconds ago                            centostest

[root@localhost ~]# docker start centostest     //启动“centostest” 容器

centostest

[root@localhost ~]# docker attach centostest

[root@1ebe9c55d469 /]#

注意一点直接执行exit将会退出并终止容器运行,需要重新start后才能连接

docker build 从dockerfile中创建一个镜像

[root@localhost ~]# docker build --help

Usage: docker build [OPTIONS] PATH | URL | -

Build a new image from the source code at PATH

-c, --cpu-shares=0    CPU shares (relative weight)

--cgroup-parent=      Optional parent cgroup for the container

--cpu-period=0        Limit the CPU CFS (Completely Fair Scheduler) period

--cpu-quota=0         Limit the CPU CFS (Completely Fair Scheduler) quota

--cpuset-cpus=        CPUs in which to allow execution (0-3, 0,1)

--cpuset-mems=        MEMs in which to allow execution (0-3, 0,1)

-f, --file=           Name of the Dockerfile (Default is 'PATH/Dockerfile')

--force-rm=false      Always remove intermediate containers

--help=false          Print usage

-m, --memory=         Memory limit

--memory-swap=        Total memory (memory + swap), '-1' to disable swap

--no-cache=false      Do not use cache when building the image

--pull=false          Always attempt to pull a newer version of the image

-q, --quiet=false     Suppress the verbose output generated by the containers

--rm=true             Remove intermediate containers after a successful build

-t, --tag=            Repository name (and optionally a tag) for the image

docker commit从一个修改后的容器创建一个新的镜像

[root@localhost ~]# docker commit --help

Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]

Create a new image from a container's changes

-a, --author=       Author (e.g., "John Hannibal Smith ")  //提交作者

-c, --change=[]     Apply Dockerfile instruction to the created image            //应用docker 指令创建镜像

--help=false        Print usage

-m, --message=      Commit message

-p, --pause=true    Pause container during commit

[root@localhost ~]# docker commit -a "soft test" -m "this is centostest container create image" -p centostest centcommit:v1.0.0

ce642745a4a78b7e64647ea55e8af812a3fc30d36976bd5f0bc5c5710dd83dd9

[root@localhost ~]# docker images    //查看镜像

REPOSITORY                TAG                 IMAGE ID            CREATED             VIRTUAL SIZE

centcommit                v1.0.0              ce642745a4a7        23 seconds ago      172.2 MB

docker cp

从一个容器文件系统拷贝文件/目录到主机路径

[root@localhost ~]# docker cp --help

Usage: docker cp [OPTIONS] CONTAINER:PATH HOSTDIR|-

Copy files/folders from a PATH on the container to a HOSTDIR on the host

running the command. Use '-' to write the data as a tar file to STDOUT.

--help=false       Print usage

docker cp name:/container_path to_path

docker cp ID:/container_path to_path

将容器centostest容器中/home目录下的aa文件拷贝到本地/home下

docker cp centostest:/home/aa /home

[root@localhost ~]# docker attach centostest

[root@1ebe9c55d469 home]# ll aa

-rw-r--r--. 1 root root 16 Sep  8 02:29 aa

[root@1ebe9c55d469 home]# cat aa

this is file aa

[root@1ebe9c55d469 home]#

[root@localhost home]# docker cp centostest:/home/aa /home

[root@localhost home]# cat aa

this is file aa

dockercreate创建一个新容器

[root@localhost ~]# docker create --help

Usage: docker create [OPTIONS] IMAGE [COMMAND] [ARG...]

Create a new container

-a, --attach=[]             Attach to STDIN, STDOUT or STDERR

--add-host=[]               Add a custom host-to-IP mapping (host:ip)

--blkio-weight=0            Block IO (relative weight), between 10 and 1000

-c, --cpu-shares=0          CPU shares (relative weight)

--cap-add=[]                Add Linux capabilities

--cap-drop=[]               Drop Linux capabilities

--cgroup-parent=            Optional parent cgroup for the container

--cidfile=                  Write the container ID to the file

--cpu-period=0              Limit CPU CFS (Completely Fair Scheduler) period

--cpu-quota=0               Limit the CPU CFS quota

--cpuset-cpus=              CPUs in which to allow execution (0-3, 0,1)

--cpuset-mems=              MEMs in which to allow execution (0-3, 0,1)

--device=[]                 Add a host device to the container

--dns=[]                    Set custom DNS servers

--dns-search=[]             Set custom DNS search domains

-e, --env=[]                Set environment variables

--entrypoint=               Overwrite the default ENTRYPOINT of the image

--env-file=[]               Read in a file of environment variables

--expose=[]                 Expose a port or a range of ports

-h, --hostname=             Container host name

--help=false                Print usage

-i, --interactive=false     Keep STDIN open even if not attached

--ipc=                      IPC namespace to use

-l, --label=[]              Set meta data on a container

--label-file=[]             Read in a line delimited file of labels

--link=[]                   Add link to another container

--log-driver=               Logging driver for container

--log-opt=[]                Log driver options

--lxc-conf=[]               Add custom lxc options

-m, --memory=               Memory limit

--mac-address=              Container MAC address (e.g. 92:d0:c6:0a:29:33)

--memory-swap=              Total memory (memory + swap), '-1' to disable swap

--name=                     Assign a name to the container

--net=bridge                Set the Network mode for the container

--oom-kill-disable=false    Disable OOM Killer

-P, --publish-all=false     Publish all exposed ports to random ports

-p, --publish=[]            Publish a container's port(s) to the host

--pid=                      PID namespace to use

--privileged=false          Give extended privileges to this container

--read-only=false           Mount the container's root filesystem as read only

--restart=no                Restart policy to apply when a container exits

--security-opt=[]           Security Options

-t, --tty=false             Allocate a pseudo-TTY

-u, --user=                 Username or UID (format: [:])

--ulimit=[]                 Ulimit options

--uts=                      UTS namespace to use

-v, --volume=[]             Bind mount a volume

--volumes-from=[]           Mount volumes from the specified container(s)

-w, --workdir=              Working directory inside the container

[root@localhost ~]# docker create -it --name centcommittest centcommit:v1.0.0   //使用centcommit:v1.0.0镜像创建一个名为centcommittest容器

24e3991b710c216135ae0c57d64619d57001c738a1e9b0dc0d73a8782dd09191

[root@localhost ~]# docker ps -a

CONTAINER ID        IMAGE                     COMMAND                CREATED              STATUS              PORTS                        NAMES

24e3991b710c        centcommit:v1.0.0         "/bin/bash"            7 seconds ago                                                         centcommittest

root@localhost ~]# docker start centcommittest  //启用新建的容器

centcommittest

[root@localhost ~]# docker ps

CONTAINER ID        IMAGE                     COMMAND                CREATED              STATUS              PORTS                        NAMES

24e3991b710c        centcommit:v1.0.0         "/bin/bash"            19 seconds ago       Up 3 seconds                                     centcommittest

使用docker create 命令新建的容器处于停止状态使用docker start 启动容器

docker diff 检查容器中文件的改变

[root@localhost ~]# docker diff --help

Usage: docker diff [OPTIONS] CONTAINER

Inspect changes on a container's filesystem

--help=false       Print usage

[root@localhost ~]# docker diff centostest

C /home

A /home/aa

C /root

A /root/.bash_history

docker diff id/name

diff会列出3种容器内文件状态变化(A --Add,D -Delete,C -Change)的列表清单,构建Imge的过程中需要的调试指令。

docker eventsGet real time events from the server

[root@localhost ~]# docker events --help

Usage: docker events [OPTIONS]

Get real time events from the server

-f, --filter=[]    Filter output based on conditions provided

--help=false       Print usage

--since=           Show all events created since timestamp

--until=           Stream events until this timestamp

docker exec直接在容器内运行命令

[root@localhost ~]# docker exec -ti centcommittest touch /home/exec

[root@localhost ~]# docker attach centcommittest

[root@24e3991b710c /]# cd /home/

[root@24e3991b710c home]# ll

total 4

-rw-r--r--. 1 root root 1222 Sep  7 08:52 aa

-rw-r--r--. 1 root root    0 Sep  8 03:44 exec

docker export归档容器内容

[root@localhost ~]# docker export --help

Usage: docker export [OPTIONS] CONTAINER

Export a filesystem as a tar archive (streamed to STDOUT by default)

--help=false       Print usage

-o, --output=      Write to a file, instead of STDOUT

root@localhost ~]# docker export centcommittest > /home/exp_centcommit.tar   //将容器centcommittest 导出到//home/exp_centcommit.tar

不论容器是否处于运行状态export 可以导出,可以将这些文件传输到其他机器上,在其他机器上通过导入命令实现容器的迁移。

docker history显示镜像历史信息

[root@localhost home]# docker history --help

Usage: docker history [OPTIONS] IMAGE

Show the history of an image

-H, --human=true     Print sizes and dates in human readable format

--help=false         Print usage

--no-trunc=false     Don't truncate output

-q, --quiet=false    Only show numeric IDs

[root@localhost home]# docker history centcommit:v1.0.0

IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT

ce642745a4a7        About an hour ago   /bin/bash                                       1.272 kB            this is centostest container create image

7322fbe74aa5        11 weeks ago        /bin/sh -c #(nop) CMD ["/bin/bash"]             0 B

c852f6d61e65        11 weeks ago        /bin/sh -c #(nop) ADD file:82835f82606420c764   172.2 MB

f1b10cd84249        4 months ago        /bin/sh -c #(nop) MAINTAINER The CentOS Proje   0 B

docker images列出镜像

[root@localhost home]# docker images --help

Usage: docker images [OPTIONS] [REPOSITORY]

List images

-a, --all=false      Show all images (default hides intermediate images)   //显示所有的镜像,

--digests=false      Show digests    //显示摘要

-f, --filter=[]      Filter output based on conditions provided    //根据提供的条件过滤输出

--help=false         Print usage

--no-trunc=false     Don't truncate output    //不截断输出,显示ID所有字符,默认只显示钱几位

-q, --quiet=false    Only show numeric IDs    //仅显示IDs

[root@localhost home]# docker images --no-trunc=true

REPOSITORY                TAG                 IMAGE ID                                                           CREATED             VIRTUAL SIZE

centcommit                v1.0.0              ce642745a4a78b7e64647ea55e8af812a3fc30d36976bd5f0bc5c5710dd83dd9   3 hours ago         172.2 MB

[root@localhost home]# docker images -q

ce642745a4a7

fafa35c3ae8c

57bca5139a13

06dd8be95164

[root@localhost home]# docker images --digests

REPOSITORY                TAG                 DIGEST              IMAGE ID            CREATED             VIRTUAL SIZE

centcommit                v1.0.0                            ce642745a4a7        3 hours ago         172.2 MB

docker import从一个压缩文件中创建一个新文件系统镜像

[root@localhost home]# docker import  --help

Usage: docker import [OPTIONS] URL|- [REPOSITORY[:TAG]]

Create an empty filesystem image and import the contents of the

tarball (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) into it, then

optionally tag it.

-c, --change=[]    Apply Dockerfile instruction to the created image

--help=false       Print usage

[root@localhost home]# ll

total 2098600

-rw-r--r--.  1 root  root          16 Sep  8 10:29 aa

-rw-r--r--.  1 root  root   179815424 Sep  8 11:57 exp_centcommit.tar

[root@localhost home]# cat exp_centcommit.tar | docker import - impcentos:v1.0.0

e579ab7d4917fbf6e040811f727217ab8cfc358f2de0b1bb158476c8392daff4

[root@localhost home]# docker images

REPOSITORY                TAG                 IMAGE ID            CREATED             VIRTUAL SIZE

impcentos                 v1.0.0              e579ab7d4917        19 seconds ago      172.2 MB

docker info  显示系统信息

[root@localhost ~]# docker info

Containers: 3

Images: 44

Storage Driver: devicemapper

Pool Name: docker-253:0-393330-pool

Pool Blocksize: 65.54 kB

Backing Filesystem: extfs

Data file: /dev/loop0

Metadata file: /dev/loop1

Data Space Used: 5.159 GB

Data Space Total: 107.4 GB

Data Space Available: 14.05 GB

Metadata Space Used: 4.653 MB

Metadata Space Total: 2.147 GB

Metadata Space Available: 2.143 GB

Udev Sync Supported: true

Deferred Removal Enabled: false

Data loop file: /var/lib/docker/devicemapper/devicemapper/data

Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata

Library Version: 1.02.93-RHEL7 (2015-01-28)

Execution Driver: native-0.2

Logging Driver: json-file

Kernel Version: 3.10.0-229.7.2.el7.x86_64

Operating System: CentOS Linux 7 (Core)

CPUs: 2

Total Memory: 1.462 GiB

Name: localhost.localdomain

ID: C6AM:P5S3:Y6W7:FDLM:2AKE:XV6D:DA57:ULYT:KLJK:3A7M:INJG:FYF7

Username: loneboo

Registry: https://index.docker.io/v1/

docker  inspect返回容器或镜像的底层信息

[root@localhost ~]# docker inspect  --help

Usage: docker inspect [OPTIONS] CONTAINER|IMAGE [CONTAINER|IMAGE...]

Return low-level information on a container or image

-f, --format=      Format the output using the given go template

--help=false       Print usage

[root@localhost ~]# docker inspect centcommittest

[

{

"Id": "24e3991b710c216135ae0c57d64619d57001c738a1e9b0dc0d73a8782dd09191",

"Created": "2015-09-08T03:21:42.199841832Z",

"Path": "/bin/bash",

"Args": [],

"State": {

"Running": true,

"Paused": false,

"Restarting": false,

"OOMKilled": false,

....

[root@localhost ~]# docker inspect -f {{".Id"}} centcommittest     //如果只要其中一项内容时,使用-f参数来制定。如获取Id信息:

24e3991b710c216135ae0c57d64619d57001c738a1e9b0dc0d73a8782dd09191

docker killkill掉一个运行的容器

[root@localhost ~]# docker kill --help

Usage: docker kill [OPTIONS] CONTAINER [CONTAINER...]

Kill a running container using SIGKILL or a specified signal

--help=false         Print usage

-s, --signal=KILL    Signal to send to the container  //发送信息通知容器

docker kill name/id

docker loadLoad an image from a tar archive

[root@localhost ~]# docker load --help

Usage: docker load [OPTIONS]

Load an image from a tar archive on STDIN

--help=false       Print usage

-i, --input=       Read from a tar archive file, instead of STDIN

[root@localhost home]#docker load --input centoscommittest.tar

docker load

docker logs获取容器的操作日志

[root@localhost home]# docker logs --help

Usage: docker logs [OPTIONS] CONTAINER

Fetch the logs of a container

-f, --follow=false        Follow log output

--help=false              Print usage

--since=                  Show logs since timestamp

-t, --timestamps=false    Show timestamps

--tail=all                Number of lines to show from the end of the logs

docker logs ID/NAME

docker pause暂停所有在容器中的进程

docker pause ID/NAME

docker ps列出容器

[root@localhost home]# docker ps --help

Usage: docker ps [OPTIONS]

List containers

-a, --all=false       Show all containers (default shows just running)

--before=             Show only container created before Id or Name

-f, --filter=[]       Filter output based on conditions provided

--help=false          Print usage

-l, --latest=false    Show the latest created container, include non-running

-n=-1                 Show n last created containers, include non-running

--no-trunc=false      Don't truncate output

-q, --quiet=false     Only display numeric IDs

-s, --size=false      Display total file sizes

--since=              Show created since Id or Name, include non-running

[root@localhost ~]# docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

e1ff99169e66        nginx               "/bin/bash"         29 minutes ago      Up 26 minutes       80/tcp, 443/tcp     elated_goldstine

列出所有容器

[root@localhost ~]# docker ps -a

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                        PORTS               NAMES

e1ff99169e66        nginx               "/bin/bash"         29 minutes ago      Up 26 minutes                 80/tcp, 443/tcp     elated_goldstine

ae3754694598        centos              "/bin/bash"         3 hours ago         Exited (137) 18 minutes ago                       dreamy_fermat

88df7394ce1a        hello-world         "/hello"            3 weeks ago         Exited (0) 30 minutes ago

docker pull 从Docker 注册服务器上下载一个镜像或资源库

[root@localhost home]# docker pull --help

Usage: docker pull [OPTIONS] NAME[:TAG|@DIGEST]

Pull an image or a repository from the registry

-a, --all-tags=false    Download all tagged images in the repository

--help=false            Print usage

docker pull name

docker push上传一个镜像或资源库到Docker注册服务器

注:不能直接使用 docker push job1,所有推送命令的格式必须是 docker push /,不加 无法推送到 Docker registry。

docker rename重命名一个存在的容器

docker rename old_name new_name

docker restart重启一个运行的容器

[root@localhost home]# docker ps

CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS              PORTS                        NAMES

1ebe9c55d469        centos:latest             "/bin/bash"            22 hours ago        Up 21 hours                                      centostest

8cd45d2ffcad        wnameless/oracle-xe-11g   "/bin/sh -c '/usr/sb   10 days ago         Up 3 hours          22/tcp, 1521/tcp, 8080/tcp   oracle11g

[root@localhost home]# docker restart centostest

centostest

docker rm删除一个或多个容器

docker rm id/name

-f,--force=false:强制终止并删除一个运行中的容器

-l,--link=false:删除容器的连接,但保留容器

-v,--volumes=false:删除容器挂载的数据卷

docker rmi删除一个或多个镜像

docker rmi id/name

docker run运行一个新的容器

[root@localhost home]# docker run --help

Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Run a command in a new container

-a, --attach=[]             Attach to STDIN, STDOUT or STDERR

--add-host=[]               Add a custom host-to-IP mapping (host:ip)

--blkio-weight=0            Block IO (relative weight), between 10 and 1000

-c, --cpu-shares=0          CPU shares (relative weight)

--cap-add=[]                Add Linux capabilities

--cap-drop=[]               Drop Linux capabilities

--cgroup-parent=            Optional parent cgroup for the container

--cidfile=                  Write the container ID to the file

--cpu-period=0              Limit CPU CFS (Completely Fair Scheduler) period

--cpu-quota=0               Limit the CPU CFS quota

--cpuset-cpus=              CPUs in which to allow execution (0-3, 0,1)

--cpuset-mems=              MEMs in which to allow execution (0-3, 0,1)

-d, --detach=false          Run container in background and print container ID

--device=[]                 Add a host device to the container

--dns=[]                    Set custom DNS servers

--dns-search=[]             Set custom DNS search domains

-e, --env=[]                Set environment variables

--entrypoint=               Overwrite the default ENTRYPOINT of the image

--env-file=[]               Read in a file of environment variables

--expose=[]                 Expose a port or a range of ports

-h, --hostname=             Container host name

--help=false                Print usage

-i, --interactive=false     Keep STDIN open even if not attached

--ipc=                      IPC namespace to use

-l, --label=[]              Set meta data on a container

--label-file=[]             Read in a line delimited file of labels

--link=[]                   Add link to another container

--log-driver=               Logging driver for container

--log-opt=[]                Log driver options

--lxc-conf=[]               Add custom lxc options

-m, --memory=               Memory limit

--mac-address=              Container MAC address (e.g. 92:d0:c6:0a:29:33)

--memory-swap=              Total memory (memory + swap), '-1' to disable swap

--name=                     Assign a name to the container

--net=bridge                Set the Network mode for the container

--oom-kill-disable=false    Disable OOM Killer

-P, --publish-all=false     Publish all exposed ports to random ports

-p, --publish=[]            Publish a container's port(s) to the host

--pid=                      PID namespace to use

--privileged=false          Give extended privileges to this container

--read-only=false           Mount the container's root filesystem as read only

--restart=no                Restart policy to apply when a container exits

--rm=false                  Automatically remove the container when it exits

--security-opt=[]           Security Options

--sig-proxy=true            Proxy received signals to the process

-t, --tty=false             Allocate a pseudo-TTY

-u, --user=                 Username or UID (format: [:])

--ulimit=[]                 Ulimit options

--uts=                      UTS namespace to use

-v, --volume=[]             Bind mount a volume

--volumes-from=[]           Mount volumes from the specified container(s)

-w, --workdir=              Working directory inside the container

docker run -t -i ubuntu /bin/bash

检查本地是否存在制定的镜像,不存在从公有仓库下载

利用镜像创建并启动一个容器

分配一个文件系统,并在只读的镜像层外面挂着一层可读写层

从宿主主机配置的网桥接口中桥接一个虚拟接口到容器中去

从地址池配置一个IP地址给容器

执行用户指定的应用程序

执行完毕后容器被终止。

-t:Docker分配一个伪终端并绑定到容器的标准输入上,

-i:让容器的标准输入保持打开。

对于创建的bash容器,当使用exit命令退出之后,容器就自动处于终止状态了,这是因为对于Docker容器来说,当运行的应用退出后,容器也就没有继续运行的必要了。

-d:让Docker容器在后台以守护状(Daemonized)形式运行

docker save保存一个镜像到一个归档文件

docker save -o centoscommittest.tar centoscommittest:latest     //归档centoscommittest:latest镜像至centoscommittest.tar

docker search在Docker Hub上搜索一个镜像

[root@localhost home]# docker search hello-world

NAME                                     DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED

hello-world                              Hello World! (an example of minimal Docker...   19        [OK]

tutum/hello-world                        Image to test docker deployments. Has Apac...   12                   [OK]

docker start启动一个已停止的容器

docker start id/name

[root@localhost home]# docker ps -a

CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS                           PORTS                        NAMES

24e3991b710c        centcommit:v1.0.0         "/bin/bash"            4 hours ago         Exited (137) About an hour ago                               centcommittest

1ebe9c55d469        centos:latest             "/bin/bash"            23 hours ago        Up 50 minutes                                                 centostest

8cd45d2ffcad        wnameless/oracle-xe-11g   "/bin/sh -c '/usr/sb   10 days ago         Up 4 hours                       22/tcp, 1521/tcp, 8080/tcp   oracle11g

[root@localhost home]# docker start centcommittest

centcommittest

[root@localhost home]# docker ps

CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS              PORTS                        NAMES

24e3991b710c        centcommit:v1.0.0         "/bin/bash"            4 hours ago        Up 2 seconds                                     centcommittest

1ebe9c55d469        centos:latest             "/bin/bash"            23 hours ago        Up 51 minutes                                    centostest

8cd45d2ffcad        wnameless/oracle-xe-11g   "/bin/sh -c '/usr/sb   10 days ago         Up 4 hours          22/tcp, 1521/tcp, 8080/tcp   oracle11g

docker stop终止运行的容器

docker stop id/name

[root@localhost ~]# docker stop dreamy_fermat

dreamy_fermat

tag       Tag an image into a repository

docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]

docker tag centoscommittest:latest  loneboo/centoscommittest:v1.0.0

top       Lookup the running processes of a container

[root@localhost home]# docker top centostest

UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD

root                9792                1195                0                   14:59               pts/2               00:00:00            /bin/bash

[root@localhost home]#

dockerunpause   Unpause a paused container 恢复被暂停的容器

docker unpause name/id

dockerversion显示daocker版本信息

[root@localhost ~]# docker version

Client version: 1.7.1

Client API version: 1.19

Go version (client): go1.4.2

Git commit (client): 786b29d

OS/Arch (client): linux/amd64

Server version: 1.7.1

Server API version: 1.19

Go version (server): go1.4.2

Git commit (server): 786b29d

OS/Arch (server): linux/amd64

wait      Block until a container stops, then print its exit code

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值