Detailed steps for uploading Docker image to Aliyun
- 2020-06-23 02:23:39
- OfStack
Install the Docker runtime environment
Reference documents: https: / / docs docker. com or https: / / www ofstack. com article / 94198. htm
Register an Aliyun account
Ali cloud's official website links: https: / / dev aliyun. com/search html
Such as:
Account: msjtest
Password: 123456
3 Login account
Manage Docker Hub mirror site: Configure Docker accelerator
Link: https: / / cr. console. aliyun. com / & # 63; spm = 5176.1971733.0.2 duOGn4 # / accelerator
Create a namespace for the image repository
For example: msj
Link: https: / / cr. console. aliyun. com / & # 63; spm = 5176.1971733.0.2. duOGn4 # / namespace/index
Create a mirror repository
For example: image - test
Link: https: / / cr. console. aliyun. com / & # 63; spm = 5176.1971733.0.2 duOGn4 # / imageList
7 Operating Instructions
1) Login docker registry:
$ sudo dockerlogin --username=msjtest registry.cn-hangzhou.aliyuncs.com
Note: The user name of registry is the full name of your Aliyun account, and the password is the password set when namespace is opened.
2) Pull mirror image from registry:
$ sudo dockerpull registry.cn-hangzhou.aliyuncs.com/msj/image-test:[ Mirror version number ]
3) Push the image to registry:
$ sudo dockerlogin --username=mashujie registry.cn-hangzhou.aliyuncs.com
$ sudo dockertag [ImageId] registry.cn-hangzhou.aliyuncs.com/msj/image-test:[ Mirror version number ]
$ sudo dockerpush registry.cn-hangzhou.aliyuncs.com/msj/image-test:[ Mirror version number ]
Where [ImageId],[mirror version number] please fill in according to your own mirror information.
Terminal execution script code
# Logon command
$ docker login --username=mashujieregistry.cn-hangzhou.aliyuncs.com
# View host images
$ docker images
# Copy the image ID And set the tag ( or tag repository:tag)
$ docker tag 96eecaf1019a registry.cn-hangzhou.aliyuncs.com/msj/image-test:helloimage01
$ docker tag image01:01registry.cn-hangzhou.aliyuncs.com/msj/image-test:helloimage01
# Upload the image to ali Cloud image warehouse
$ docker pushregistry.cn-hangzhou.aliyuncs.com/msj/image-test:helloimage01