我眼中的 Docker(二)Image

新博客链接

Docker 安装

如何安装 docker 详见官网: installation 或者 中文指南.
不过 linux 上我推荐用 curl 安装,因为 apt-get 中源要么没有 docker,要么版本较低。

$ sudo apt-get install curl
$ sudo curl -sSL https://get.docker.com/ | sh
$ sudo docker run hello-world

最后一个命令成功的话说明 docker 可以正常运行。
然而因为中国显而易见的国情原因,推荐还是使用 DaoCloud 服务安装吧:

# curl -sSL https://get.daocloud.io/docker | sh

好了之后最好配置一下 DaoCloud 的加速服务(加速器),即设置 mirror:

$ echo "DOCKER_OPTS=\"\$DOCKER_OPTS --registry-mirror=http://f9495414.m.daocloud.io\"" | sudo tee -a /etc/default/docker
$ sudo service docker restart

Image 命令

Image 是 docker 的基石,命令的介绍可以直接看官方文档: doc
常用命令有:

$ # 列出所有镜像
$ sudo docker images
$ # pull 新镜像
$ sudo docker pull hello-world
$ # tag 一个镜像,tag 对于一个镜像就像引用计数一样
$ sudo docker tag hello-world myname/hello-world
$ # push 镜像到 docker hub
$ sudo docker push myname/hello-world
$ # 在 docker hub 搜索镜像
$ sudo docker search ubuntu
$ # 删除一个镜像
$ sudo docker rmi hello-wo
  • 6
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值