运维之我的docker-仓库使用和镜像提交
2017-01-19 00:35
771 查看
前言: 我这里为了方便大家使用写了两个版本分别是官方docker提交方法和阿里云的方便大家熟悉各个环境国内的阿里云提供了国内的docker仓库,而且docker有单独的密码进行登录,如果不指定tag拉取镜像默认版本是“lastest ”大家可以快速使用方法如下: docker官方提交方法官方仓库使用也需要注册帐号
path/image:[tag]
###########################| 华丽的分割线 |################################
这里开始说一下阿里云docker的用法,阿里云docker的密码是单独的在这里
首先登录阿里云 docker帐号
登录registry的用户名是您的阿里云账号全名,密码是您开通namespace时设置的密码。
下面的“f062fe1dd4fe”是我的镜像ID,last是我的镜像版本
1.在docker官网上注册账户后创建一个nginxs/centos7的仓库
https://hub.docker.com/2.在你本地登录
[root@salt-node1 .docker]# 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: nginxs Password: Login Succeeded
3.给指定镜像ID打tag
语法: docker tag [image_ID] path/image:[tag] [root@salt-node1 ~]# docker tag 00f6c5817350 nginxs/centos7:last
4.提交你的镜像
语法:docker pushpath/image:[tag]
[root@salt-node1 .docker]# docker push nginxs/centos7:last The push refers to a repository [docker.io/nginxs/centos7] 34e7b85d83e4: Pushed last: digest: sha256:dafc45b8b533d5ad5564a3821e9e1a252b58f44e69c6052bddcd00139782ee08 size: 5295.提交完成你就可以就看到你的镜像多了一个tag
6.运行一个容器,-t 并在本地创建一个伪终端,-I 并建立一个标准输入的连接允许操作
[root@salt-node1 .docker]# docker run -t -i nginxs/centos7:last /bin/bash [root@5993a66d45c5 /]# ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 5 16:05 ? 00:00:00 /bin/bash root 13 1 0 16:05 ? 00:00:00 ps -ef
###########################| 华丽的分割线 |################################
这里开始说一下阿里云docker的用法,阿里云docker的密码是单独的在这里
首先登录阿里云 docker帐号
登录registry的用户名是您的阿里云账号全名,密码是您开通namespace时设置的密码。
[root@salt-node1 ~]# docker login --username=nginxs@126.com registry.cn-hangzhou.aliyuncs.com Password: Email: nginxs@126.com WARNING: login credentials saved in /root/.docker/config.json Login Succeeded从阿里云拉取一下镜像到本地
[root@salt-node1 ~]# docker pull registry.cn-hangzhou.aliyuncs.com/cloudist/redis Using default tag: latest Trying to pull repository registry.cn-hangzhou.aliyuncs.com/cloudist/redis ... latest: Pulling from registry.cn-hangzhou.aliyuncs.com/cloudist/redis 81cc5f26a6a0: Pull complete a3ed95caeb02: Pull complete d43cb752619e: Pull complete 861e96e7ae14: Pull complete 7fae3dcea8af: Pull complete b46c28ddbe0c: Pull complete 2d50fb4bcfa7: Pull complete c8fc9e7dfb8b: Pull complete a1a961e320bc: Pull complete Digest: sha256:598a6f07bdb0763ee3fc32cdcb2c6e99e16d6cf204f1ac4f97288c61e3e5a1af Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/cloudist/redis:latest给本地镜像打一个标签last
下面的“f062fe1dd4fe”是我的镜像ID,last是我的镜像版本
[root@salt-node1 ~]# docker tag f062fe1dd4fe registry.cn-hangzhou.aliyuncs.com/forker/centos7ssh:last下面是提交本地镜像到仓库
[root@salt-node1 ~]# docker push registry.cn-hangzhou.aliyuncs.com/forker/centos7ssh:last The push refers to a repository [registry.cn-hangzhou.aliyuncs.com/forker/centos7ssh] acce4ec5f074: Pushed 5d450a8c7e38: Pushed e8fd5087fa08: Pushed cf394a2f01e4: Pushed f16d5ac23cee: Pushed 57861a68f43a: Pushed 97ca462ad9ee: Pushed last: digest: sha256:b0851324bac55083172ed2068dfb388acabdce14dffdb9787f4e6c044b524f19 size: 1764第一次运行你的docker镜像
[root@salt-node1 bai]# docker run centos7 cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core)
相关文章推荐
- 使用Docker registry镜像创建私有仓库
- 企业级Docker镜像仓库的管理和运维
- 使用Maven 插件构建docker 镜像和推送仓库
- 企业级Docker镜像仓库harbor的部署和使用
- 使用官方 docker registry 搭建私有镜像仓库及部署 web ui
- Docker基本命令与使用 —— Docker镜像与仓库(二)
- Docker 入门使用 镜像编排 docker仓库 命令总结
- 使用docker registry建立私有镜像仓库
- docker使用阿里云镜像仓库的方法
- docker使用阿里云镜像仓库
- 使用Docker registry镜像创建私有仓库的方法
- docker镜像仓库harbor快速部署和使用
- 第四章 使用Docker镜像和仓库
- 使用国内docker 镜像仓库
- 使用Dockerfile构建镜像并push到私有仓库
- 使用Dockerfile构建镜像并push到私有仓库
- 使用nexus3作为docker镜像仓库
- Docker使用国内镜像仓库
- 使用python脚本获取docker私有镜像仓库镜像信息