标签:docker
通过模板创建镜像模板下载地址
下载 centos-6-x86-minimal.tar.gz
[root@localhost ~]# curl -O http://download.openvz.org/template/precreated/centos-6-x86-minimal.tar.gz
导入镜像
[root@localhost ~]# cat centos-6-x86-minimal.tar.gz |docker import - centos-6
sha256:d1b29eff72b9f7ae2762b71ebc64485e7ae9c1d36c9a1c5fc39e7cbac0cd3ec2
查看镜像
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos-6 latest d1b29eff72b9 About a minute ago 512MB
new_centos latest 6618fdb3c813 About an hour ago 358MB
centos latest e934aafc2206 8 hours ago 199MB
ubuntu latest f975c5035748 4 weeks ago 112MB
将镜像centos-6启动为容器,进入到容器中,查看运行平台
[root@localhost ~]# docker run -itd centos-6 bash
a038f9b57652886ac288fe33b93c25f39eed6f6ff4d5e71b1d4d4928ffceca07
[root@localhost ~]# docker exec -it a038f9b57652 bash
[root@a038f9b57652 /]# uname -r
3.10.0-693.el7.x86_64
导出镜像
[root@localhost ~]# docker save -o centos.tar centos
删除镜像,导入镜像
[root@localhost ~]# docker rmi centos
[root@localhost ~]# docker load --input centos.tar 或 docker load < centos.tar
把镜像上传到dockerhub官方,需要先注册一个用户
# docker push image_name
标签:docker
原文地址:http://blog.51cto.com/13480443/2095347