Devops(三):Docker常用命令

列出镜像列表(docker images)

[[email protected] docker]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              fce289e99eb9        7 months ago        1.84kB
[[email protected] docker]# 

各个指标项说明::
REPOSITORY:表示镜像的仓库源
TAG:镜像的标签
IMAGE ID:镜像ID
CREATED:镜像创建时间
SIZE:镜像大小

启动镜像(docker run)

Docker 允许你在容器内运行应用程序, 使用 docker run 命令来在容器内运行一个应用程序。

语法

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

参数说明:

-a stdin: 指定标准输入输出内容类型,可选 STDIN/STDOUT/STDERR 三项;
-d: 后台运行容器,并返回容器ID;
-i: 以交互模式运行容器,通常与 -t 同时使用;
-P: (将容器内部使用的网络端口映射到我们使用的主机上)随机端口映射,容器内部端口随机映射到主机的高端口
-p: 指定端口映射,格式为:主机(宿主)端口:容器端口
-t: 为容器重新分配一个伪输入终端,通常与 -i 同时使用;
--name="nginx-lb": 为容器指定一个名称;
--dns 8.8.8.8: 指定容器使用的DNS服务器,默认和宿主一致;
--dns-search example.com: 指定容器DNS搜索域名,默认和宿主一致;
-h "mars": 指定容器的hostname;
-e username="ritchie": 设置环境变量;
--env-file=[]: 从指定文件读入环境变量;
--cpuset="0-2" or --cpuset="0,1,2": 绑定容器到指定CPU运行;
-m :设置容器使用内存最大值;
--net="bridge": 指定容器的网络连接类型,支持 bridge/host/none/container: 四种类型;
--link=[]: 添加链接到另一个容器;
--expose=[]: 开放一个端口或一组端口;
--volume , -v: 绑定一个卷

实例

使用docker镜像nginx:latest以后台模式启动一个容器,并将容器命名为mynginx。

docker run --name mynginx -d nginx:latest

使用镜像nginx:latest以后台模式启动一个容器,并将容器的80端口映射到主机随机端口。

docker run -P -d nginx:latest

使用镜像 nginx:latest,以后台模式启动一个容器,将容器的 80 端口映射到主机的 80 端口,主机的目录 /data 映射到容器的 /data。

docker run -p 80:80 -v /data:/data -d nginx:latest

绑定容器的 8080 端口,并将其映射到本地主机 127.0.0.1 的 80 端口上。

docker run -p 127.0.0.1:80:8080/tcp ubuntu bash

使用镜像nginx:latest以交互模式启动一个容器,在容器内执行/bin/bash命令。

[email protected] docker]# docker run -it nginx:latest /bin/bash
[email protected]:/#

使用镜像centos 以交互模式启动一个容器,在容器内执行/bin/bash命令。

[email protected] docker]# docker run --name mydocker -t -i centos /bin/bash
Unable to find image ‘centos:latest‘ locally
latest: Pulling from library/centos
d8d02d457314: Pull complete
Digest: sha256:307835c385f656ec2e2fec602cf093224173c51119bbebd602c53c3653a3d6eb
Status: Downloaded newer image for centos:latest
[[email protected] /]# ps aux
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root          1  0.0  0.0  11820  1896 pts/0    Ss   15:00   0:00 /bin/bash
root         15  0.0  0.0  51740  1732 pts/0    R+   15:01   0:00 ps aux
[[email protected] /]#
[[email protected] /]# exit
exit
[[email protected] docker]# 

使用镜像 sath89/oracle-12c,以后台模式启动一个名称为“oracle12c”的容器,将容器的 1521端口映射到主机的 1521端口,主机的目录 /usr/local/data_temp 映射到容器的/home/oracle/data_temp。

#创建一个文件目录,用于挂载到容器内,做oracle数据备份时数据存放的位置,保证备份数据不丢失。
mkdir /usr/local/data_temp
chmod 777 /usr/local/data_temp
docker run -d --name oracle12c -p 1521:1521 -v /usr/local/data_temp:/home/oracle/data_temp sath89/oracle-12c

备注:oracle12c是名称,-p是端口映射,-v是将宿主机的/usr/local/data_temp 目录映射到容器内的 /home/oracle/data_temp内。

列出容器列表(docker ps )

语法
docker ps [OPTIONS]
OPTIONS说明:
-a :显示所有的容器,包括未运行的。
-f :根据条件过滤显示的内容。
--format :指定返回值的模板文件。
-l :显示最近创建的容器。
-n :列出最近创建的n个容器。
--no-trunc :不截断输出。
-q :静默模式,只显示容器编号。
-s :显示总的文件大小。

[email protected] docker]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
32098924b2e0        hello-world         "/hello"            6 minutes ago       Exited (0) 6 minutes ago                       hopeful_northcutt
b07906c995f3        hello-world         "/hello"            7 minutes ago       Exited (0) 7 minutes ago                       keen_goldstine
[[email protected] docker]# docker ps -a -l
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
32098924b2e0        hello-world         "/hello"            8 minutes ago       Exited (0) 8 minutes ago                       hopeful_northcutt

查询最后一次创建的容器

[[email protected] docker]# docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

[[email protected] docker]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
99d7fbb94565 hello-world "/hello"     3 seconds ago Exited (0)   3 seconds ago gracious_panini
1d8a5ab31830 centos      "/bin/bash" 34 minutes ago Exited (137) 4 minutes ago mydocker
[[email protected] docker]# docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
99d7fbb94565 hello-world "/hello"    21 seconds ago Exited (0)   21 seconds ago gracious_panini
[[email protected] docker]#

进入容器方法

一、attach(不建议使用)

注意:此方法当exit退出容器后,进程也就结束了,容器就关闭了。不建议使用

[[email protected] docker]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
1d8a5ab31830        centos              "/bin/bash"         4 minutes ago       Exited (0) 2 minutes ago                        mydocker
32098924b2e0        hello-world         "/hello"            16 minutes ago      Exited (0) 16 minutes ago                       hopeful_northcutt
b07906c995f3        hello-world         "/hello"            17 minutes ago      Exited (0) 17 minutes ago                       keen_goldstine
[[email protected] docker]# docker start 1d8a5ab31830  #再次将容器启动
1d8a5ab31830
[[email protected] docker]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
1d8a5ab31830        centos              "/bin/bash"         5 minutes ago       Up 6 seconds                                    mydocker
32098924b2e0        hello-world         "/hello"            16 minutes ago      Exited (0) 16 minutes ago                       hopeful_northcutt
b07906c995f3        hello-world         "/hello"            18 minutes ago      Exited (0) 18 minutes ago                       keen_goldstine
[[email protected] docker]# docker attach 1d8a5ab31830
[[email protected] /]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[[email protected] /]# exit
exit
[[email protected] docker]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
1d8a5ab31830        centos              "/bin/bash"         8 minutes ago       Exited (0) 3 seconds ago                        mydocker
32098924b2e0        hello-world         "/hello"            19 minutes ago      Exited (0) 19 minutes ago                       hopeful_northcutt
b07906c995f3        hello-world         "/hello"            20 minutes ago      Exited (0) 20 minutes ago                       keen_goldstine
[[email protected] docker]# 

attach总结:一个容器指定一个进程,这个容器退出了。他的生成周期也就结束了,也就退出了。

二、exec

注意:此方法当exit退出容器后,进程不结束,容器也不关闭。

docker exec -it 1d8a5ab31830 /bin/bash #其中 1d8a5ab31830 为容器ID号
docker exec :在运行的容器中执行命令
OPTIONS说明:
-d :分离模式: 在后台运行
-i :即使没有附加也保持STDIN 打开
-t :分配一个伪终端

[[email protected] docker]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
1d8a5ab31830        centos              "/bin/bash"         8 minutes ago       Exited (0) 3 seconds ago                        mydocker
32098924b2e0        hello-world         "/hello"            19 minutes ago      Exited (0) 19 minutes ago                       hopeful_northcutt
b07906c995f3        hello-world         "/hello"            20 minutes ago      Exited (0) 20 minutes ago                       keen_goldstine
[[email protected] docker]# docker exec -it 1d8a5ab31830 /bin/bash
Error response from daemon: Container 1d8a5ab31830dc16e3129a6e123a5c16bc10989aeced01a3be62d236ee76cb0d is not running
[[email protected] docker]# docker start 1d8a5ab31830
1d8a5ab31830
[[email protected] docker]# docker exec -it 1d8a5ab31830 /bin/bash
[[email protected] /]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[[email protected] /]# exit
exit
[[email protected] docker]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
1d8a5ab31830        centos              "/bin/bash"         10 minutes ago      Up 23 seconds                                   mydocker
32098924b2e0        hello-world         "/hello"            21 minutes ago      Exited (0) 21 minutes ago                       hopeful_northcutt
b07906c995f3        hello-world         "/hello"            23 minutes ago      Exited (0) 23 minutes ago                       keen_goldstine
[[email protected] docker]# 

三、nsenter(推荐使用这个命令进入容器)

注意:当退出容器后,还能让容器再后台运行。推荐使用这个命令进入容器。

[[email protected] docker]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                      PORTS               NAMES
1d8a5ab31830        centos              "/bin/bash"         10 minutes ago      Up 23 seconds                                   mydocker
32098924b2e0        hello-world         "/hello"            21 minutes ago      Exited (0) 21 minutes ago                       hopeful_northcutt
b07906c995f3        hello-world         "/hello"            23 minutes ago      Exited (0) 23 minutes ago                       keen_goldstine
[[email protected] docker]# docker stop 1d8a5ab31830
1d8a5ab31830
[[email protected] docker]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                       PORTS               NAMES
1d8a5ab31830        centos              "/bin/bash"         13 minutes ago      Exited (137) 4 seconds ago                       mydocker
32098924b2e0        hello-world         "/hello"            24 minutes ago      Exited (0) 24 minutes ago                        hopeful_northcutt
b07906c995f3        hello-world         "/hello"            26 minutes ago      Exited (0) 26 minutes ago                        keen_goldstine
[[email protected] docker]# docker start 1d8a5ab31830     #要先启动容器,才能进入容器里边
1d8a5ab31830
[[email protected] docker]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
1d8a5ab31830        centos              "/bin/bash"         13 minutes ago      Up 5 seconds                            mydocker
[[email protected] docker]# docker inspect --format "{{.State.Pid}}" 1d8a5ab31830     #查看容器的进程ID
2841
[[email protected] docker]# nsenter -t 2841 -u -i -n     #进入容器
[[email protected] docker]#
[[email protected] docker]# exit                   #退出容器,进程还在
logout
[[email protected] docker]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
1d8a5ab31830        centos              "/bin/bash"         15 minutes ago      Up About a minute                       mydocker
[[email protected] docker]# 

可以写一个脚本方便进容器:

[[email protected] docker]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
1d8a5ab31830        centos              "/bin/bash"         21 minutes ago      Up 7 minutes                            mydocker
[[email protected] docker]# echo ‘‘ > shelldocker.sh
[[email protected] docker]#
[[email protected] docker]# vi shelldocker.sh
#!/bin/bash
PID=$(docker inspect --format "{{.State.Pid}}" $1)
nsenter -t $PID -u -i -n
~
"shelldocker.sh" 3L, 88C written
[[email protected] docker]#
[[email protected] docker]# ls
shelldocker.sh
[[email protected] docker]# chmod +x shelldocker.sh
[[email protected] docker]#
[[email protected] docker]# ./shelldocker.sh 1d8a5ab31830
[[email protected] docker]# exit
logout
[[email protected] docker]# 

查找镜像(docker search)

使用 docker search 命令来从 Docker Hub 网站来搜索镜像

docker search nginx(查找镜像)

[[email protected] docker]# docker search nginx
NAME                              DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
nginx                             Official build of Nginx.                        11852               [OK]
jwilder/nginx-proxy               Automated Nginx reverse proxy for docker con…   1641                                    [OK]
richarvey/nginx-php-fpm           Container running Nginx + PHP-FPM capable of…   735                                     [OK]
linuxserver/nginx                 An Nginx container, brought to you by LinuxS…   73
bitnami/nginx                     Bitnami nginx Docker Image                      70                                      [OK]
tiangolo/nginx-rtmp               Docker image with Nginx using the nginx-rtmp…   51                                      [OK]
jc21/nginx-proxy-manager          Docker container for managing Nginx proxy ho…   23
nginxdemos/hello                  NGINX webserver that serves a simple page co…   23                                      [OK]
nginx/nginx-ingress               NGINX Ingress Controller for Kubernetes         20
jlesage/nginx-proxy-manager       Docker container for Nginx Proxy Manager        20                                      [OK]
schmunk42/nginx-redirect          A very simple container to redirect HTTP tra…   17                                      [OK]
crunchgeek/nginx-pagespeed        Nginx with PageSpeed + GEO IP + VTS + more_s…   13
blacklabelops/nginx               Dockerized Nginx Reverse Proxy Server.          12                                      [OK]
centos/nginx-18-centos7           Platform for running nginx 1.8 or building n…   11
centos/nginx-112-centos7          Platform for running nginx 1.12 or building …   10
nginxinc/nginx-unprivileged       Unprivileged NGINX Dockerfiles                  9
sophos/nginx-vts-exporter         Simple server that scrapes Nginx vts stats a…   5                                       [OK]
nginx/nginx-prometheus-exporter   NGINX Prometheus Exporter                       5
1science/nginx                    Nginx Docker images that include Consul Temp…   5                                       [OK]
mailu/nginx                       Mailu nginx frontend                            3                                       [OK]
pebbletech/nginx-proxy            nginx-proxy sets up a container running ngin…   2                                       [OK]
travix/nginx                      NGinx reverse proxy                             2                                       [OK]
centos/nginx-110-centos7          Platform for running nginx 1.10 or building …   0
ansibleplaybookbundle/nginx-apb   An APB to deploy NGINX                          0                                       [OK]
wodby/nginx                       Generic nginx                                   0                                       [OK]

拉取镜像(docker pull )

docker pull nginx(拉取镜像)

[[email protected] docker]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
1ab2bdfe9778: Pull complete
a17e64cfe253: Pull complete
e1288088c7a8: Pull complete
Digest: sha256:53ddb41e46de3d63376579acf46f9a41a8d7de33645db47a486de9769201fec9
Status: Downloaded newer image for nginx:latest
[[email protected] docker]# 

从容器创建一个新的镜像(docker commit )

语法
docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
OPTIONS说明:
-a :提交的镜像作者;
-c :使用Dockerfile指令来创建镜像;
-m :提交时的说明文字;
-p :在commit时,将容器暂停。

实例

将容器a404c6c174a2 保存为新的镜像,并添加提交人信息和说明信息。

[[email protected] docker]# docker commit -a "runoob.com(提交的镜像作者)" -m "my apache(提交是的说明文字)" a404c6c174a2  mymysql:v1
sha256:37af1236adef1544e8886be23010b66577647a40bc02c0885a6600b33ee28057
[[email protected] docker]# docker images mymysql:v1
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
mymysql             v1                  37af1236adef        15 seconds ago      329 MB

推送镜像(docker push)

TODO....

暂时参考《通过容器提交镜像(docker commit)以及推送镜像(docker push)笔记

容器内部的标准输出(docker logs)

docker logs [ID或者名字]    可以查看容器内部的标准输出

$ docker logs 353e6c82b2fc
$ docker logs -f 353e6c82b2fc
-f:让 dokcer logs 像使用 tail -f 一样来输出容器内部的标准输出。docker logs [ID或者名字]
[[email protected] docker]# docker logs 1d8a5ab31830
[[email protected] /]#  ps aux
bash: 平ps: command not found
[[email protected] /]# ps aux
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root          1  0.0  0.0  11820  1896 pts/0    Ss   15:00   0:00 /bin/bash
root         15  0.0  0.0  51740  1732 pts/0    R+   15:01   0:00 ps aux
[[email protected] /]#
[[email protected] /]# exit
exit
[[email protected] /]# echo PATH
PATH
[[email protected] /]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[[email protected] /]# exit
exit
[[email protected] /]# [[email protected] docker]# 

docker logs -f [ID或者名字]

[email protected] docker]# docker logs -f 1d8a5ab31830
[[email protected] /]#  ps aux
bash: 平ps: command not found
[[email protected] /]# ps aux
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root          1  0.0  0.0  11820  1896 pts/0    Ss   15:00   0:00 /bin/bash
root         15  0.0  0.0  51740  1732 pts/0    R+   15:01   0:00 ps aux
[[email protected] /]#
[[email protected] /]# exit
exit
[[email protected] /]# echo PATH
PATH
[[email protected] /]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[[email protected] /]# exit
exit
[[email protected] /]# 

停止应用容器(docker stop)

$ docker stop [cid|names] (可以使用cid和容器名)

[[email protected] docker]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
1d8a5ab31830        centos              "/bin/bash"         29 minutes ago      Up 15 minutes                           mydocker
[[email protected] docker]# docker stop mydocker
mydocker
[[email protected] docker]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[[email protected] docker]# 

移除应用容器(docker rm)

$ docker rm [CID|NAMES] 可以使用cid和容器名)

$ docker rm -f CID|NAMES

[[email protected] docker]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                            PORTS               NAMES
1d8a5ab31830        centos              "/bin/bash"         31 minutes ago      Exited (137) About a minute ago                       mydocker
32098924b2e0        hello-world         "/hello"            42 minutes ago      Exited (0) 42 minutes ago                             hopeful_northcutt
b07906c995f3        hello-world         "/hello"            44 minutes ago      Exited (0) 44 minutes ago                             keen_goldstine
[[email protected] docker]# docker rm hopeful_northcutt
hopeful_northcutt
[[email protected] docker]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                            PORTS               NAMES
1d8a5ab31830        centos              "/bin/bash"         31 minutes ago      Exited (137) About a minute ago                       mydocker
b07906c995f3        hello-world         "/hello"            44 minutes ago      Exited (0) 44 minutes ago                             keen_goldstine
[[email protected] docker]# docker rm b07906c995f3
b07906c995f3
[[email protected] docker]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                       PORTS               NAMES
1d8a5ab31830        centos              "/bin/bash"         32 minutes ago      Exited (137) 2 minutes ago                       mydocker
[[email protected] docker]# 

Docker删除容器与镜像(不建议使用,使用要注意)

停止所有的container,这样才能够删除其中的images:

docker stop $(docker ps -a -q)
docker kill $(docker ps -a -q)

如果想要删除所有container的话再加一个指令:

docker rm $(docker ps -a -q)

删除images,通过image的id来指定删除谁

docker rmi <image id>

想要删除untagged images,也就是那些id为的image的话可以用

docker rmi $(docker images | grep "^<none>" | awk "{print $3}")

要删除全部image的话

docker rmi $(docker images -q)

强制删除全部image的话

docker rmi -f $(docker images -q)

参考:《2、CentOS7 Docker 安装以及基本使用,链接:https://blog.csdn.net/weixin_41515615/article/details/81349688》



原文地址:https://www.cnblogs.com/yy3b2007com/p/11403190.html

时间: 2024-10-14 14:19:24

Devops(三):Docker常用命令的相关文章

(三) Docker 常用操作与CentOS7 防火墙命令

参考并感谢 Docker 常用命令 https://docs.docker.com/engine/reference/commandline/docker/ Docker 登录docker账户 docker login -u 用户名 -p 密码 根据本地待上传镜像 修改新镜像,新镜像名称需要与hub中的repository保持一致 docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG] 查看所有镜像 docker images 查看特定镜像 docker

【Application】Docker 常用命令(三)

Docker常用命令 info|version 1.info docker info : 显示 Docker 系统信息,包括镜像和容器数 语法:docker info [OPTIONS] 例:docker info 2.version docker version :显示 Docker 版本信息. 语法:docker version [OPTIONS] OPTIONS说明: -f :指定返回值的模板文件. 例:docker version 镜像命令 1.images docker images

Docker快速入门——Docker常用命令

Docker快速入门--Docker常用命令 一.Docker命令简介 1.Docker命令简介 Docker的命令清单可以通过运行sudo docker或者sudo docker help命令查看.Docker容器技术在不断演化过程中,Docker的子命令已经达到41个,其中核心子命令(例如:run)还会有复杂的参数配置.Docker命令根据功能和使用场景可以分为4个部分. 2.Docker用户组 Docker守护进程绑定的是一个unix ?socket,而不是TCP端口,默认的属主是root

docker常用命令、镜像命令、容器命令、数据卷,使用dockerFile创建镜像,dockefile的语法规则。

一.docker常用命令? 1. 常用帮助命令 1.1 docker的信息以及版本号 /* docker info 查看docker的信息 images2 docker本身就是一个镜像. docker version 查看docker的版本号 */ 1.2 docker的启动,停止,重启,查看状态. // service docker start/stop/restart/status 二.镜像命令? 1. 列举出所有的镜像(本地镜像) /* docker images 所拥有的参数: dock

Docker 常用命令

Docker 常用命令: 1.环境相关 docker info docker version 2.系统运维相关 docker images docker Image是多层结构的,默认只显示最顶层的Image docker inspect 查看容器运行时详细信息的命令  docker ps docker ps打印出正在运行的容器,docker ps -a打印出所有运行过的容器 docker pull docker run docker start/stop/restart 这组命令可以开启(两个:

docker常用命令及配置修改

docker修改国内源仓库地址: vim /etc/docker/daemon.json { "registry-mirrors": ["https://registry.docker-cn.com"] } docker常用命令 docker --help:获取docker帮助 docker container: 创建docker镜像 镜像管理: docker image --help ls : 列出镜像 images : 查看所有镜像信息 history : 查看

Docker 常用命令——镜像

Docker 常用命令 帮助命令 docker version    --版本信息 docker info       --详细信息 docker --help     --帮助 镜像命令 1.docker images -- List Local images Options:  -a, --all             Show all images (default hides intermediate images)     #显示所有镜像,包括中间层      --digests  

[转帖]Docker常用命令总结

Docker常用命令总结 http://www.ha97.com/5546.html 发表于: Linux, 互联网, 虚拟化与云计算 | 作者: 博客教主 标签: docker,常用命令,总结 PS:Docker这个虚拟化容器(跟虚拟机原理有区别,可以理解成内核级虚拟化应用容器)最近比较流行,花点时间研究一下,确实是个好东西,以后可能会对云计算的PaaS层有很大改变.目前只支持Linux 3.8以上内核,安装很简单,这里不说了,纪录下常用的命令,以后再深入研究是否上生产环境. 直接输入dock

Docker | 第三章:Docker常用命令

前言 上一章节,简单介绍了在CentOS下的Docker的安装过程,以及运行了一个官方提供的Hello,World镜像运行了第一个Docker.就像上一章中,验证Docker是否安装成功,我们执行的是docker info命令.运行镜像时,执行的是docker run imagesName.所以学习一个工具,主要还是学习如何利用本身工具提供的一些命令进行相应的操作.所以本章节,主要来介绍下Docker的常用命令. Docker命令清单 镜像常用命令 容器常用命令 其他常用命令 总结 最后 参考资