巴西网站建设,微网站自助建站,我要找工作 招聘附近,搜外文章目录 发布镜像到DockerHub发布镜像到自建Docker仓库(Harbor)修改配置文件在Linux服务器中登录Docker打TAGPUSH提交镜像PULL拉取镜像 发布镜像到阿里云容器服务在Linux服务器中登录DockerPUSH提交镜像PULL拉取镜像 发布镜像到DockerHub
本地我们镜像命名可能会不规范#… 文章目录 发布镜像到DockerHub发布镜像到自建Docker仓库(Harbor)修改配置文件在Linux服务器中登录Docker打TAGPUSH提交镜像PULL拉取镜像 发布镜像到阿里云容器服务在Linux服务器中登录DockerPUSH提交镜像PULL拉取镜像 发布镜像到DockerHub
本地我们镜像命名可能会不规范发布时想重新命名进行发布到DockerHub我们可以使用docker tag命令 格式 docker tag $IMAGEID $新的标签[:版本] docker tag 66c054090a43 [toc] # 发布镜像到DockerHub本地我们镜像命名可能会不规范发布时想重新命名进行发布到DockerHub我们可以使用docker tag命令格式docker tag $IMAGEID $新的标签[:版本]docker tag 66c054090a43 jast/tag:1.0[roottest16 ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEjast-test-docker 0.1.0 66c054090a43 47 minutes ago 638MB[roottest16 ~]# docker tag 66c054090a43 jast/tag:1.0[roottest16 ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEjast-test-docker 0.1.0 66c054090a43 47 minutes ago 638MBjast/tag 1.0 66c054090a43 47 minutes ago 638MB登录需要先进行账号注册地址:[https://hub.docker.com](https://hub.docker.com)docker login -u username发布docker push jast/tag:1.0# 发布镜像到自建Docker仓库(Harbor)## 修改配置文件修改需要提交的配置文件 /etc/docker/daemon.jsonjson{registry-mirrors: [https://pv0k1ghm.mirror.aliyuncs.com,https://docker.mirrors.ustc.edu.cn,http://hub-mirror.c.163.com],max-concurrent-downloads: 10,log-driver: json-file,log-level: warn,log-opts: {max-size: 10m,max-file: 3},data-root: /var/lib/docker,insecure-registries: [ 192.168.1.1:10080], # 这里配置私有Docker服务地址}## 在Linux服务器中登录Dockershell$ docker login 192.168.1.1:10080Username: adminPassword: ## 打TAGshelldocker tag test:1.6 192.168.1.1:10080/bigdata/test:1.6## PUSH提交镜像shelldocker push 192.168.1.1:10080/bigdata/test:1.6## PULL拉取镜像shelldocker pull 192.168.1.1:10080/bigdata/test:1.6# 发布镜像到阿里云容器服务[https://cr.console.aliyun.com/cn-hangzhou/instances](https://cr.console.aliyun.com/cn-hangzhou/instances)1. 登录阿里云进入镜像服务 创建命名空间2. 创建镜像仓库3. 创建完成后会自动弹出说明## 在Linux服务器中登录Docker登录阿里云Docker Registryshell$ docker login --usernametb7****6464 registry.cn-hangzhou.aliyuncs.com 用于登录的用户名为阿里云账号全名密码为开通服务时设置的密码。 您可以在访问凭证页面修改凭证密码。 登录成功shell[roottest16 ~]# docker login --usernameusername registry.cn-hangzhou.aliyuncs.comPassword: WARNING! Your password will be stored unencrypted in /root/.docker/config.json.Configure a credential helper to remove this warning. Seehttps://docs.docker.com/engine/reference/commandline/login/#credentials-storeLogin Succeeded## PUSH提交镜像**push镜像到阿里云仓库**官方介绍如下shell$ docker login --usernamealiyunUsername registry.cn-hangzhou.aliyuncs.com$ docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:[镜像版本号]$ docker push registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:[镜像版本号]请根据实际镜像信息替换示例中的[ImageId]和[镜像版本号]参数。实际操作[roottest16 ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEjast-test-docker 0.1.0 66c054090a43 2 hours ago 638MB[roottest16 ~]# docker tag 66c054090a43 registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:0.0.1[roottest16 ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEjast-test-docker 0.1.0 66c054090a43 2 hours ago 638MBregistry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test 0.0.1 66c054090a43 2 hours ago 638MB# 上传到阿里云仓库[roottest16 ~]# docker push registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:0.0.1The push refers to repository [registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test]27b2dc42c067: Pushed 7e28f1f4e30c: Pushed 74ddd0ec08fa: Pushed 0.0.1: digest: sha256:20d452aa1528bb8e1f236781a74b9e5e4af657470dfb6936af6dbc827923c5aa size: 954**在阿里云上查看镜像**发现成功上传## PULL拉取镜像**在Linux服务器上拉取镜像**官方介绍shell$ docker pull registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:[镜像版本号]实际拉取操作可以看到我们拉取回来的镜像shell[roottest16 ~]# docker pull registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:0.0.10.0.1: Pulling from jast-zsh/jast-testa1d0c7532777: Already exists 56ca049bf4be: Already exists 524200aa718d: Already exists Digest: sha256:20d452aa1528bb8e1f236781a74b9e5e4af657470dfb6936af6dbc827923c5aaStatus: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:0.0.1registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:0.0.1[roottest16 ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEregistry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test 0.0.1 66c054090a43 2 hours ago 638MB# jast/tag:1.0
[roottest16 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
jast-test-docker 0.1.0 66c054090a43 47 minutes ago 638MB
[roottest16 ~]# docker tag 66c054090a43 jast/tag:1.0
[roottest16 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
jast-test-docker 0.1.0 66c054090a43 47 minutes ago 638MB
jast/tag 1.0 66c054090a43 47 minutes ago 638MB登录 需要先进行账号注册地址:https://hub.docker.com
docker login -u username发布
docker push jast/tag:1.0发布镜像到自建Docker仓库(Harbor)
修改配置文件
修改需要提交的配置文件 /etc/docker/daemon.json
{registry-mirrors: [https://pv0k1ghm.mirror.aliyuncs.com,https://docker.mirrors.ustc.edu.cn,http://hub-mirror.c.163.com],max-concurrent-downloads: 10,log-driver: json-file,log-level: warn,log-opts: {max-size: 10m,max-file: 3},data-root: /var/lib/docker,insecure-registries: [ 192.168.1.1:10080], # 这里配置私有Docker服务地址}在Linux服务器中登录Docker
$ docker login 192.168.1.1:10080
Username: admin
Password: 打TAG
docker tag test:1.6 192.168.1.1:10080/bigdata/test:1.6PUSH提交镜像
docker push 192.168.1.1:10080/bigdata/test:1.6PULL拉取镜像
docker pull 192.168.1.1:10080/bigdata/test:1.6发布镜像到阿里云容器服务
https://cr.console.aliyun.com/cn-hangzhou/instances
登录阿里云进入镜像服务 创建命名空间
2. 创建镜像仓库
创建完成后会自动弹出说明
在Linux服务器中登录Docker
登录阿里云Docker Registry
$ docker login --usernametb7****6464 registry.cn-hangzhou.aliyuncs.com用于登录的用户名为阿里云账号全名密码为开通服务时设置的密码。 您可以在访问凭证页面修改凭证密码。 登录成功
[roottest16 ~]# docker login --usernameusername registry.cn-hangzhou.aliyuncs.com
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-storeLogin SucceededPUSH提交镜像
push镜像到阿里云仓库 官方介绍如下
$ docker login --usernamealiyunUsername registry.cn-hangzhou.aliyuncs.com
$ docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:[镜像版本号]
$ docker push registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:[镜像版本号]请根据实际镜像信息替换示例中的[ImageId]和[镜像版本号]参数。实际操作
[roottest16 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
jast-test-docker 0.1.0 66c054090a43 2 hours ago 638MB
[roottest16 ~]# docker tag 66c054090a43 registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:0.0.1
[roottest16 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
jast-test-docker 0.1.0 66c054090a43 2 hours ago 638MB
registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test 0.0.1 66c054090a43 2 hours ago 638MB# 上传到阿里云仓库
[roottest16 ~]# docker push registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:0.0.1
The push refers to repository [registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test]
27b2dc42c067: Pushed
7e28f1f4e30c: Pushed
74ddd0ec08fa: Pushed
0.0.1: digest: sha256:20d452aa1528bb8e1f236781a74b9e5e4af657470dfb6936af6dbc827923c5aa size: 954在阿里云上查看镜像 发现成功上传
PULL拉取镜像
在Linux服务器上拉取镜像 官方介绍
$ docker pull registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:[镜像版本号]实际拉取操作可以看到我们拉取回来的镜像
[roottest16 ~]# docker pull registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:0.0.1
0.0.1: Pulling from jast-zsh/jast-test
a1d0c7532777: Already exists
56ca049bf4be: Already exists
524200aa718d: Already exists
Digest: sha256:20d452aa1528bb8e1f236781a74b9e5e4af657470dfb6936af6dbc827923c5aa
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:0.0.1
registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test:0.0.1
[roottest16 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.cn-hangzhou.aliyuncs.com/jast-zsh/jast-test 0.0.1 66c054090a43 2 hours ago 638MB