【docker】镜像制作build、tag、push至阿里云仓库以及pull

需要先在阿里云创建镜像服务实例:https://cr.console.aliyun.com/cn-beijing/instances

本地制作及发布:

docker login --username=[阿里云用户名] registry.cn-beijing.aliyuncs.com

docker build -t [镜像名]:[版本号] .

docker tag [镜像名]:[版本号] [镜像仓库]/[镜像名]:[版本号]

docker push [镜像仓库]/[镜像名]:[版本号]
docker login --username=[阿里云用户名] registry.cn-beijing.aliyuncs.com

docker build -t [镜像名]:[版本号] .

docker tag [镜像名]:[版本号] registry.cn-beijing.aliyuncs.com/lorogy/[镜像名]:[版本号]

docker push registry.cn-beijing.aliyuncs.com/lorogy/[镜像名]:[版本号]

服务器运行:

docker login --username=[阿里云用户名] registry.cn-beijing.aliyuncs.com

docker pull registry.cn-beijing.aliyuncs.com/lorogy/[镜像名]:[版本号]

docker run -idt --name [容器名称] --restart=always -p [宿主机端口号]:[容器端口号] registry.cn-beijing.aliyuncs.com/lorogy/[镜像名]:[版本号]

你可能感兴趣的:(运维,微服务,docker)