[root@docker03 ~/docker]# docker run -d -p 80:80 nginx:latest nginx -g 'deamon off;' 28aa819caa8823d34b1b6ff3a365bf5e7fed37619a5121bfd6552d5d45e809eb
root@docker03 ~/docker]# docker ps -a CONAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES fc18cfe46896 nginx:latest "nginx -g 'daemon of…" 3 seconds ago Up 2 seconds 0.0.0.0:80->80/tcp wonderful_joliot
[root@docker03 ~/docker]# docker ps
[root@docker03 ~/docker]# docker run -it centos [root@4a52d871171c /]#
[root@docker03 ~/docker]# docker create kod:v1 [root@docker03 ~/docker]# docker create --name oldshuai kod:v1 [root@docker03 ~/docker]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 31b70cbdb48c kod:v1 "/bin/bash" 2 seconds ago Created oldshuai
[root@docker03 ~/docker]# docker start oldshuai oldshuai
[root@docker03 ~/docker]# docker stop oldshuai oldshuai
[root@docker03 ~/docker]# docker kill 02f13815bbc4 02f13815bbc4
[root@docker03 ~/docker]# docker restart 3744637195dd 3744637195dd
[root@docker03 ~/docker]# docker rm oldshuai oldshuai [root@docker03 ~/docker]# docker rm -f oldshuai (删除正在运行的容器) [root@docker03 ~/docker]#[root@docker03 ~/docker]# docker rm -f `docker ps -a -q`(删除所有容器)
[root@docker03 ~/docker]# docker exec -it 3744637195d /bin/bash 初始命令/bin/bash或/bin/sh root@3744637195dd:/#
注:容器的初始命令必须夯住,否则容器会退出
[root@22732407347e /]# /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@docker03 /dockerfile/centos6.9]# docker run -it --workdir /opt centos:6.9 /bin/bash [root@7beca86cb54f opt]#
[root@docker03 ~]# docker run -d kod:v1 3a5ef1de432348245e81ea2a0a988c42fcc430eec46adc8ec38ad77bd549dc22 [root@docker03 ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3a5ef1de4323 kod:v1 "/bin/bash" 29 seconds ago Exited (0) 28 seconds ago relaxed_swartz [root@docker03 ~]# docker cp relaxed_swartz:/etc/php-fpm.d/www.conf . [root@docker03 ~]# ls anaconda-ks.cfg docker www.conf
[root@docker03 /dockerfile/ssh]# docker history ssh_centos7:v1 IMAGE CREATED CREATED BY SIZE COMMENT 5d3ed4ecb74c 13 minutes ago /bin/sh -c #(nop) CMD ["/bin/sh" "-c" "/usr… 0B b671cb873a41 13 minutes ago /bin/sh -c echo '123456'|passwd --stdin root 514B 9ad687ac33b9 13 minutes ago /bin/sh -c /usr/sbin/sshd-keygen 2.92kB e4c58b902735 13 minutes ago /bin/sh -c yum install openssh-server init… 146MB c941d6ab860f 14 minutes ago /bin/sh -c curl -o /etc/yum.repos.d/CentOS-B… 2.52kB bec3e6d53d07 14 minutes ago /bin/sh -c curl -o /etc/yum.repos.d/epel.rep… 664B 5e35e350aded 5 weeks ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0B <missing> 5 weeks ago /bin/sh -c #(nop) LABEL org.label-schema.sc… 0B <missing> 5 weeks ago /bin/sh -c #(nop) ADD file:45a381049c52b5664… 203MB