[iyunv@xiaoluo src]# docker run -it centos /bin/bash
[iyunv@73aaba6e0cd1 /]#
启动docker:
1
2
3
4
5
[iyunv@localhost ~]# docker run -d -p 2222:22 --name base csphere/centos:7.193e712c9d91467c0748961685e5453a7cd50898212191a762a36c6e933dbd539
*-d 后台启动
-p 本机端口2222映射到docker内部的22口(当然前提镜像是提前构建好,后期会讲到)
--name 给容器起一个别名 base
镜像名称csphere/centos:7.1
查看正在启动的容器:
1
2
3
[iyunv@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
93e712c9d914 csphere/centos:7.1 "/usr/bin/supervisord" About a minute ago Up About a minute 0.0.0.0:2222->22/tcp base
*查看所有的容器使用docker ps -a
删除容器:docker rm 93e712c9d914 (删除正在运行的容器docker rm f)
[iyunv@localhost ~]# docker tag 7e4f044162b7 192.168.63.198:5000/test
*把镜像ID为7e4f044162b7定义别名192.168.63.198:5000/test
1
2
3
4
5
6
7
8
[iyunv@localhost native]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
192.168.63.198:5000/test latest 7e4f044162b7 8 days ago 724.9 MB
csphere/mysql 5.5 7e4f044162b7 8 days ago 724.9 MB
csphere/php-fpm 5.4 f149fdc3bb11 8 days ago 684.8 MB
csphere/centos 7.1 e3570ed66dc9 8 days ago 591.3 MB
index.alauda.cn/library/registry latest 07d93e41c370 4 weeks ago 422.8 MB
docker.io/centos centos7.1.1503 fab4b1df8eb1 4 months ago 212.1 MB
3、本地启动本地镜像厂库:
1
[iyunv@localhost ~]#docker run -d -p 5000:5000 -v /opt/data/registry/:/tmp/registry-dev 07d93e41c370
unable to ping registry endpoint
https://yourip:5000/v0/
v2 ping attempt failed with error: Get https://yourip:5000/v2/:EOF
v1 ping attempt failed with error: Get https://yourop:5000/v1/_ping:EOF