阿里云镜像上传打包

每次从国外下代码非常慢,阿里云提供了镜像服务,镜像上传到案例与怒再拉到本地会快很多
上传镜像到阿里云
[root@nana php7.1]# docker images
REPOSITORY                                               TAG                 IMAGE ID            CREATED             SIZE
mysql5.7                                                 latest              1b12f2e9257b        10 days ago         448MB


#登陆:
docker login --username=阿里云账号 registry.cn-hangzhou.aliyuncs.com


#打标
docker tag [ImageId] registry.cn-hangzhou.aliyuncs.com/chenleilei/mysql:[镜像版本号]

如:
docker tag mysql registry.cn-hangzhou.aliyuncs.com/chenleilei/mysql5.7:latest


#上传镜像到阿里云
docker push registry.cn-hangzhou.aliyuncs.com/chenleilei/mysql5.7:latest



#使用:
docker  run -d \
--name lnmp_mysql \
--net network_lnmp \
--mount src=mysql-vol,dst=/var/lib/mysql \
-e MYSQL_ROOT_PASSWORD=123456 \
-e MYSQL_DATABASE=dede \
registry.cn-hangzhou.aliyuncs.com/chenleilei/mysql5.7 \
--character-set-server=utf8

#测试
[root@nana php7.1]# mysql -h 172.18.0.2 -uroot -p123456
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.7.32 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> 
posted @ 2020-11-02 21:44  陈雷雷  阅读(304)  评论(0编辑  收藏  举报