[root@localhost ~]# docker image rm f41e0c55a09a
Untagged: crpi-61kqwp5ugch8hao1.cn-hangzhou.personal.cr.aliyuncs.com/ylzzone/zprint_tomcat:8.5
Untagged: crpi-61kqwp5ugch8hao1.cn-hangzhou.personal.cr.aliyuncs.com/ylzzone/zprint_tomcat@sha256:61a3748e8be4d27edb1a45a707bbad32cda9679773397db0fa79c828d4af0eee
Deleted: sha256:f41e0c55a09afa83a366e5292df4b980d833b7415dba37ea4f50d1b95e07e581
[root@localhost ~]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
crpi-61kqwp5ugch8hao1.cn-hangzhou.personal.cr.aliyuncs.com/ylzzone/zprint_mysql 5.7 3fae0828f4b4 4 days ago 507MB
mysql 8.0 12a2ae8fe734 3 months ago 772MB
hello-world latest 74cc54e27dc4 6 months ago 10.1kB
dpanel/dpanel lite 6f81b76efea8 8 months ago 159MB
tomcat 8.5 0a2249be3d31 16 months ago 456MB
mysql 5.7 5107333e08a8 19 months ago 501MB
registry.cn-beijing.aliyuncs.com/dc3/iot-dc3-web 2023.4.0.demo 4f9cdb8a7a03 2 years ago 22.1MB
registry.cn-beijing.aliyuncs.com/dc3/dc3-mysql 2023.4.0.demo ac415318842e 2 years ago 449MB
registry.cn-beijing.aliyuncs.com/dc3/dc3-gateway 2023.4.0.demo 7ca89202d3bc 2 years ago 244MB
registry.cn-beijing.aliyuncs.com/dc3/dc3-center-manager 2023.4.0.demo 87a93b5cacf1 2 years ago 241MB
registry.cn-beijing.aliyuncs.com/dc3/dc3-center-data 2023.4.0.demo 02507a999618 2 years ago 253MB
registry.cn-beijing.aliyuncs.com/dc3/dc3-center-auth 2023.4.0.demo 37b010ca4c2f 2 years ago 239MB
registry.cn-beijing.aliyuncs.com/dc3/dc3-driver-virtual 2023.4.0.demo 3ae832335eef 2 years ago 185MB
registry.cn-beijing.aliyuncs.com/dc3/dc3-mongo 2023.4.0.demo 61fa1629960b 2 years ago 736MB
registry.cn-beijing.aliyuncs.com/dc3/dc3-rabbitmq 2023.4.0.demo 3f30ca529949 2 years ago 108MB
registry.cn-beijing.aliyuncs.com/dc3/dc3-redis 2023.4.0.demo 0fafd8a3e04c 2 years ago 32.5MB
registry.cn-beijing.aliyuncs.com/dc3/dc3-center-register 2023.4.0.demo 880a539df928 2 years ago 544MB
crpi-61kqwp5ugch8hao1.cn-hangzhou.personal.cr.aliyuncs.com/ylzzone/mydockerdemo latest 97f57120105e 2 years ago 341MB
2. 镜像创建过程实例
bash复制代码
[root@localhost ~]# cd /app/zprint-tomcat/
[root@localhost zprint-tomcat]# ls
conf Dockerfile logs temp webapps zprint_tomcat_build.sh
[root@localhost zprint-tomcat]# sh zprint_tomcat_build.sh
[+] Building 7.3s (9/9) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 424B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/tomcat:8.5 0.0s
=> [1/4] FROM docker.io/library/tomcat:8.5 0.0s
=> [internal] load build context 7.2s
=> => transferring context: 76.69MB 7.0s
=> CACHED [2/4] RUN mkdir -p /usr/local/tomcat/webapps 0.0s
=> CACHED [3/4] COPY webapps/ /usr/local/tomcat/webapps/ 0.0s
=> CACHED [4/4] COPY conf/server.xml /usr/local/tomcat/conf/ 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:20a4645b4bbe1445284b10730bcbf5fbc6aa94aae8a7951b3f253a8deb60e114 0.0s
=> => naming to crpi-61kqwp5ugch8hao1.cn-hangzhou.personal.cr.aliyuncs.com/ylzzone/zprint_tomcat:8.5 0.0s
请手动执行登录(如需推送):
docker login --username=ailiylz crpi-61kqwp5ugch8hao1.cn-hangzhou.personal.cr.aliyuncs.com
构建完成。如需推送,请执行:
docker push crpi-61kqwp5ugch8hao1.cn-hangzhou.personal.cr.aliyuncs.com/ylzzone/zprint_tomcat:8.5
[root@localhost zprint-tomcat]# docker login --username=ailiylz crpi-61kqwp5ugch8hao1.cn-hangzhou.personal.cr.aliyuncs.com
Password:
Error response from daemon: Get "https://crpi-61kqwp5ugch8hao1.cn-hangzhou.personal.cr.aliyuncs.com/v2/": Get "https://dockerauth.cn-hangzhou.aliyuncs.com/auth?account=ailiylz&client_id=docker&offline_token=true&service=registry.aliyuncs.com%3Acn-hangzhou%3A26842": read tcp 192.168.1.199:53244->120.55.35.37:443: read: connection reset by peer
[root@localhost zprint-tomcat]# docker login --username=ailiylz crpi-61kqwp5ugch8hao1.cn-hangzhou.personal.cr.aliyuncs.com
Password:
Error response from daemon: Get "https://crpi-61kqwp5ugch8hao1.cn-hangzhou.personal.cr.aliyuncs.com/v2/": Get "https://dockerauth.cn-hangzhou.aliyuncs.com/auth?account=ailiylz&client_id=docker&offline_token=true&service=registry.aliyuncs.com%3Acn-hangzhou%3A26842": read tcp 192.168.1.199:35932->120.55.35.34:443: read: connection reset by peer
[root@localhost zprint-tomcat]# docker login --username=ailiylz crpi-61kqwp5ugch8hao1.cn-hangzhou.personal.cr.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-store
Login Succeeded
[root@localhost zprint-tomcat]# ^C
[root@localhost zprint-tomcat]# docker push crpi-61kqwp5ugch8hao1.cn-hangzhou.personal.cr.aliyuncs.com/ylzzone/zprint_tomcat:8.5
The push refers to repository [crpi-61kqwp5ugch8hao1.cn-hangzhou.personal.cr.aliyuncs.com/ylzzone/zprint_tomcat]
24fc90e0759b: Layer already exists
acc82c5341a3: Layer already exists
5f70bf18a086: Pushed
2a0c096d3062: Layer already exists
fb0f37a0ea02: Layer already exists
02a99687e95e: Layer already exists
3e75af8aba85: Layer already exists
c2ef3e72aded: Layer already exists
d5a8ba654b65: Layer already exists
17031737aa00: Layer already exists
5498e8c22f69: Layer already exists
8.5: digest: sha256:4aaab71ca074a0f1266b0c646cd178923bf6eb00ae46caea73ec60441063c11b size: 2621
[root@localhost zprint-tomcat]#
3.docker-compse 容器管理实例
bash复制代码
Last login: Mon Jul 21 16:14:42 2025 from 192.168.1.120
[root@localhost ~]# cd /app/zprint_test/
[root@localhost zprint_test]# ls
zprint.yaml
[root@localhost zprint_test]# docker-compose -f zprint.yaml up -d
[+] Running 4/4
✔ Network zprint_test_zprint_net Created 0.1s
✔ Volume "zprint_test_zprint_tomcat_webapps" Created 0.0s
✔ Container zprint_db Healthy 0.3s
✔ Container zprint_tomcat Started 12.0s
[root@localhost zprint_test]# docker-compose -f zprint.yaml down
[+] Running 3/3
✔ Container zprint_tomcat Removed 0.4s
✔ Container zprint_db Removed 1.3s
✔ Network zprint_test_zprint_net Removed 0.1s
[root@localhost zprint_test]# docker-compose -f zprint.yaml up -d
[+] Running 5/5
✔ Network zprint_test_zprint_net Created 0.1s
✔ Volume "zprint_test_zprint_tomcat_conf" Created 0.0s
✔ Volume "zprint_test_zprint_tomcat_webapps" Created 0.0s
✔ Container zprint_db Healthy 0.0s
✔ Container zprint_tomcat Started 5.0s