PS C:\WINDOWS\system32> docker version Client: Version: 17.12.0-ce API version: 1.35 Go version:go1.9.2 Git commit:c97c6d6 Built: Wed Dec 2720:05:222017 OS/Arch: windows/amd64
Server: Engine: Version: 17.12.0-ce API version: 1.35 (minimum version 1.12) Go version: go1.9.2 Git commit: c97c6d6 Built:Wed Dec 2720:12:292017 OS/Arch: linux/amd64 Experimental: true
会出现很多版本相关信息。
1 2 3 4 5 6 7 8 9
PS C:\WINDOWS\system32> docker images //查看当前已有镜像 REPOSITORY TAG IMAGE ID CREATED SIZE centos latest 2d194b392dd1 32 hours ago195MB docker4w/nsenter-dockerdlatest cae870735e91 4 months ago187kB registry.cn-hangzhou.aliyuncs.com/diligentyang/centos6.7_nginx_1.10_php5.6.29 v1.0072258802250 14 months ago 854MB
关于镜像可以使用命令:
1
docker search centos
来查找与centos相关的镜像
1 2 3 4 5 6 7 8 9 10
PS C:\WINDOWS\system32> docker search centos NAME DESCRIPTION STARS OFFICIAL AUTOMATED centos The official build of CentOS. 4079[OK] ansible/centos7-ansibleAnsible on Centos7 105 ··· 其中越靠前是STARS越多,相当于使用的人最多,当我们选择了一个镜像后查看它的AUTOMATED就能直接拉取镜像 ```php docker pull registry.cn-hangzhou.aliyuncs.com/diligentyang/centos6.7_nginx_1.10_php5.6.29:v1.0
这里使用的是一个阿里云搭建的php5.6+nginx1.10的镜像
1
$ docker run -p 80:80 --name ali -it 5a7e /bin/bash
[root@ec600fcf672e /]# ls bin dev home lib64 lost+found mnt opt root selinux sys usr boot etc lib local media mysql-community-release-el7-5.noarch.rpm proc sbin srv tmp var
该镜像已经配置好了php环境,所以我们只需要:
1 2
[root@ec600fcf672e /]# php-fpm [root@ec600fcf672e /]# service nginx
PS C:\WINDOWS\system32> docker ps -a CONTAINER IDIMAGE COMMAND CREATED STATUS PORTS NAMES ec600fcf672e0722"/bin/bash" About an hour ago Up About an hour 0.0.0.0:80->8 tcp ali fe985915775ecentos "ls"6 hours ago Exited (0) 6 hours ago