首页 > 代码库 > 基于CentOS学习docker笔记

基于CentOS学习docker笔记

在nginx容器内编辑配置文件:将宿主的vi所在的目录挂载为容器的/bin

docker run -it -v /usr/bin:/bin nginx /bin/sh
#vi /etc/nginx/nginx.conf



批量删除容器:

docker rm $(docker ps -a -q)


[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                    PORTS               NAMES
8e4ca9b36187        learn/ping          "ping www.baidu.com"     23 hours ago        Exited (0) 23 hours ago                       adoring_leavitt
aaf15374785c        learn/tutorial      "apt-get install -y p"   24 hours ago        Exited (0) 24 hours ago                       high_perlman
3cae0f4e0f90        learn/tutorial      "echo ‘hello world‘"     24 hours ago        Exited (0) 24 hours ago                       determined_mcnulty
f0a26e9ce9a8        nginx:1.9           "nginx -g ‘daemon off"   38 hours ago        Exited (0) 8 hours ago                        high_hodgkin
a892ef304b92        nginx:1.9           "nginx -g ‘daemon off"   38 hours ago        Created                                       pedantic_northcutt
[root@localhost ~]# docker rm $(docker ps -a -q)
8e4ca9b36187
aaf15374785c
3cae0f4e0f90
f0a26e9ce9a8
a892ef304b92
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES


基于CentOS学习docker笔记