你好,游客 登录 注册 搜索
背景:
阅读新闻

tag上、push上和pull 取Docker 映像

[日期:2017-01-27] 来源:Linux社区  作者:baishoujing [字体: ]

tag上、push上和pull 取Docker 映像,在此之前需要拥有一个docker Hub账户,注册地址:https://hub.docker.com/

Tag、Push Docker映像

  1. 使用docker images 获取当前拥有的映像列表,其中可获取映像ID。
    $ docker images
     REPOSITORY           TAG          IMAGE ID            CREATED             SIZE
     docker-whale         latest       7d9495d03763        38 minutes ago      273.7 MB
     <none>               <none>       5dac217f722c        45 minutes ago      273.7 MB
     docker/whalesay      latest       fb434121fc77        4 hours ago         247 MB
     hello-world          latest       91c95931e552        5 weeks ago         910 B
  2. 查找特定映像的ID,如 docker-whale:这个例子中的ID是:7d9495d03763 。注意:'REPOSITORY' 显示的是docker-whale的仓库名称,而不是命令空间,你需要将命令空间和你的Docker Hub账户联系起来,你的命令空间要和你的账户的账  户名称相同,因此将其重命名'YOUR_DOCKERHUB_NAME/docker-whale' 。
     $ docker tag 7d9495d03763 maryatdocker/docker-whale:latest
    maryatdocker为自己的DockerHub账户。
  3. docker login命令用于在命令行中登录Docker Hub账户:
     $ docker login
     Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
     Username:
     Password:
     Login Succeeded
  4. push 命令用于将映像推送到仓库当中:
     $ docker push maryatdocker/docker-whale
         The push refers to a repository [maryatdocker/docker-whale] (len: 1)
         7d9495d03763: Image already exists
         c81071adeeb5: Image successfully pushed
         eb06e47a01d2: Image successfully pushed
         fb434121fc77: Image successfully pushed
         5d5bd9951e26: Image successfully pushed
         99da72cfe067: Image successfully pushed
         1722f41ddcb5: Image successfully pushed
         5b74edbcaa5b: Image successfully pushed
         676c4a1897e6: Image successfully pushed
         07f8e8c5e660: Image successfully pushed
         37bea4ee0c81: Image successfully pushed
         a82efea989f9: Image successfully pushed
         e9e06b06e14c: Image successfully pushed
         Digest: sha256:ad89e88beb7dc73bf55d456e2c600e0a39dd6c9500d7cd8d1025626c4b985011

Pull 获取最新创建的映像

  1. 使用docker rmi -f 强力移除本地已经存在的映像:
     $ docker rmi -f 7d9495d03763
     $ docker rmi -f docker-whale

    PS:使用ID或者名称均可。

  2. 使用docker run 命令从仓库中拉取并载入映像:
    docker run yourusername/docker-whale

     PS:此处应该包含对应的Docker Hub账户名。

更多Docker相关教程见以下内容

Docker安装应用(CentOS 6.5_x64) http://www.linuxidc.com/Linux/2014-07/104595.htm

Ubuntu 14.04安装Docker  http://www.linuxidc.com/linux/2014-08/105656.htm

Ubuntu使用VNC运行基于Docker的桌面系统  http://www.linuxidc.com/Linux/2015-08/121170.htm

阿里云CentOS 6.5 模板上安装 Docker http://www.linuxidc.com/Linux/2014-11/109107.htm

Ubuntu 15.04下安装Docker  http://www.linuxidc.com/Linux/2015-07/120444.htm

在Ubuntu Trusty 14.04 (LTS) (64-bit)安装Docker http://www.linuxidc.com/Linux/2014-10/108184.htm

在 Ubuntu 15.04 上如何安装Docker及基本用法 http://www.linuxidc.com/Linux/2015-09/122885.htm

Ubuntu 16.04上Docker使用手记 http://www.linuxidc.com/Linux/2016-12/138490.htm

Docker 的详细介绍请点这里
Docker 的下载地址请点这里

本文永久更新链接地址http://www.linuxidc.com/Linux/2017-01/139989.htm

linux
相关资讯       Docker映像 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款