09 将镜像推送到阿里云

登陆阿里云平台

https://cr.console.aliyun.com/

1. 登录阿里云Docker Registry
$ sudo docker login --username=胖嘟嘟的脸5790 registry.cn-chengdu.aliyuncs.com
用于登录的用户名为阿里云账号全名,密码为开通服务时设置的密码。

您可以在访问凭证页面修改凭证密码。

2. 从Registry中拉取镜像
$ sudo docker pull registry.cn-chengdu.aliyuncs.com/diablofmb/diablofmb:[镜像版本号]
3. 将镜像推送到Registry
$ sudo docker login --username=胖嘟嘟的脸5790 registry.cn-chengdu.aliyuncs.com
$ sudo docker tag [ImageId] registry.cn-chengdu.aliyuncs.com/diablofmb/diablofmb:[镜像版本号]
$ sudo docker push registry.cn-chengdu.aliyuncs.com/diablofmb/diablofmb:[镜像版本号]


[root@localhost data]# podman login --username=胖嘟嘟的脸5790 registry.cn-chengdu.aliyuncs.com
Password: 
Login Succeeded!
[root@localhost data]#
[root@localhost data]# podman tag c379423344cf registry.cn-chengdu.aliyuncs.com/diablofmb/diablofmb:1.0
[root@localhost data]#
[root@localhost data]#
[root@localhost data]# podman push registry.cn-chengdu.aliyuncs.com/diablofmb/diablofmb:1.0
Getting image source signatures
Copying blob ca0b443ed34f done
Copying blob c2272e12f440 done
Copying blob cbc685c15fb9 done
Copying blob e1c5cde52113 done
Copying blob 291f6e44771a done
Copying config c379423344 done
Writing manifest to image destination
Copying config c379423344 done
Writing manifest to image destination
Storing signatures
[root@localhost data]#

验证:

[root@localhost data]# podman images
REPOSITORY                                             TAG           IMAGE ID       CREATED        SIZE
localhost/simon_tomcat9                                latest        c379423344cf   27 hours ago   624 MB
registry.cn-chengdu.aliyuncs.com/diablofmb/diablofmb   1.0           c379423344cf   27 hours ago   624 MB
docker.io/library/mariadb                              latest        cbbff8572fa8   3 days ago     413 MB
docker.io/library/redis                                latest        84c5f6e03bf0   9 days ago     108 MB
docker.io/library/centos                               latest        0d120b6ccaa8   5 weeks ago    222 MB

# 删除本地镜像:
[root@localhost data]# podman rmi -f c379423344cf
54e72f5e97b52b90c27790d4ac0f691add010f8e7640c35398ec96111e35de92
1abf909fb75a31b27d1d18186a5a7582a70762f3a7163502712545f221022ab0
004c6740731727c81b5dc3c0ac97a2089f06543d2121d15e709680d63095ecd8
ee4ace0c5fa9c222fb8311f4895a2d985bb67dbacec65a6ae4650756c47b8f2f
a6dd584e3dc4b362b59d341b07f8ad81059ec6c42c337dcb2f07e1e99ffa7c11
45c660fe629c8b0a6f0e092886edfc8b05827316cd4c69ba9d54d054afa1ad34
b1d727ace50c74d6b7fbde364c628368fd3f467f626161834289df3686bcc4bb
ea6e5fd9e0890904cff9db930888d2c7c07b5f4815998dad78bb9028c7f980b5
0c5acb5eb45dc2a6d88ac8db608463379d3158bc879510a6809108970c4898f6
9a02c2aad25863a758d78230aa256088afedfe4b89812da3def99c2baac353b9
0443497b3f8cbcd489c89d053d0b258bb6ae4a65c4595101300dfe43e95dceff
b756e1663e8712bea344cf0aed0ac2ebde59e3f2a2e919a2c9ec1d46761bc278
2f5a63fc1342c94164ccb83ca721898f16cf86185bcdc9346d79e027d9324a5d
Untagged: localhost/simon_tomcat9:latest
Untagged: registry.cn-chengdu.aliyuncs.com/diablofmb/diablofmb:1.0
Deleted: c379423344cf83efbe56e470e18a1d4892e6ecf3bd1e6711c4a07cfe99c2f827
[root@localhost data]#

# 从阿里云重新拉取刚才上传的镜像
[root@localhost data]# podman pull registry.cn-chengdu.aliyuncs.com/diablofmb/diablofmb:1.0
Trying to pull registry.cn-chengdu.aliyuncs.com/diablofmb/diablofmb:1.0...
Getting image source signatures
Copying blob 590ac07fde4c skipped: already exists
Copying blob bee63bfc47f5 done
Copying blob 6abfca2df80b done
Copying blob dee8c155a76c done
Copying blob 44eebb32e8db done
Copying config c379423344 done
Writing manifest to image destination
Storing signatures
c379423344cf83efbe56e470e18a1d4892e6ecf3bd1e6711c4a07cfe99c2f827
[root@localhost data]#
[root@localhost data]# podman images
REPOSITORY                                             TAG           IMAGE ID       CREATED        SIZE
registry.cn-chengdu.aliyuncs.com/diablofmb/diablofmb   1.0           c379423344cf   27 hours ago   624 MB
docker.io/library/mariadb                              latest        cbbff8572fa8   3 days ago     413 MB
docker.io/library/redis                                latest        84c5f6e03bf0   9 days ago     108 MB
docker.io/library/centos                               latest        0d120b6ccaa8   5 weeks ago    222 MB

[root@localhost data]# podman run --name "tomcat9" -p 9080:8080 -d c379423344cf
aecaa8248af8a72dd3ad10c62977909cfe8656d8b9c3acc827ca2ec2df4a140b
[root@localhost data]#

[root@localhost data]# podman ps
CONTAINER ID  IMAGE                                                       COMMAND               CREATED        STATUS            PORTS                   NAMES
aecaa8248af8  registry.cn-chengdu.aliyuncs.com/diablofmb/diablofmb:1.0    /bin/sh -c /usr/l...  5 seconds ago  Up 4 seconds ago  0.0.0.0:9080->8080/tcp  tomcat9
[root@localhost data]# podman exec -it aecaa8248af8 /bin/bash
[root@aecaa8248af8 local]# 
[root@aecaa8248af8 local]# pwd
/usr/local
[root@aecaa8248af8 local]# wget --version|head -n 2
GNU Wget 1.19.5 built on linux-gnu.

[root@aecaa8248af8 local]# 

浏览器打开:http://localhost:9080

posted @ 2022-11-24 20:45  oldSimon  阅读(500)  评论(0编辑  收藏  举报