How to update, package, and upload Docker containers to Alibaba Cloud

How to update, package, and upload Docker containers to Alibaba Cloud

This time, we will try to package the running container into an image and upload it to Alibaba Cloud, so that it can be downloaded and used more conveniently elsewhere.

After all, it is not difficult to install Docker, but the problem is that some special configurations are troublesome, so just make it and it will be much easier to pull and run it next time

First, enter the mirror. If it is not clear, you can read the previous chapter.

[root@VM_0_4_centos bin]# docker exec -it 8bf811453641 /bin/bash

Then update the image:

root@8bf811453641:/# apt-get update

You need to exit after updating here:

exit

Then commit the copy of the container to create a new image:

[root@VM_0_4_centos bin]# docker commit -m "nginx_my" -a "szy" 8bf811453641 niginx_my/nginx:v1

Successfully returned sha code:

[root@VM_0_4_centos bin]# docker commit -m "nginx_my" -a "szy" 8bf811453641 niginx_my/nginx:v1
sha256:1836e4017c607fdd790068da627366e4e0c0cbe2c0dc53626f9a3fe0a2d03ab2

It can be found that the image has been packaged successfully:

Run the new container:

[root@VM_0_4_centos bin]# docker run --name nginx_test2 -d -p 80:80 niginx_my/nginx:v1

You can run a new container and see the results.

At this point, the image has been created. Let's upload the image.

This is the image repository uploaded to Alibaba Cloud, and then bound to the GIT repository, and the pull is also pulled from here. Here is a record;

Also thanks to https://blog.csdn.net/jacksonary/article/details/78961612 for the method I got from here.

Enter the control backend of Alibaba Cloud:

Then create the image repository:

After creation, select the code source:

This is relatively simple, just bind a repository to your GIT account. Just bind it.

After successful creation, enter the warehouse configuration:

Alibaba Cloud has already provided the pull and push instructions, you just need to run them.

Here we also experiment with uploading the image to the warehouse.

Just copy the instructions and upload them. It's very simple, but the uploading process will be a bit slow.

[root@VM_0_4_centos ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
niginx_my/nginx v1 1836e4017c60 16 hours ago 125MB
hello-world latest 4ab4c602aa5e 10 days ago 1.84kB
nginx latest 06144b287844 13 days ago 109MB
[root@VM_0_4_centos ~]# docker login --username=sun29550 registry.cn-qingdao.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@VM_0_4_centos ~]# docker tag [1836e4017c60] registry.cn-qingdao.aliyuncs.com/mysokou/soko_2:v1
Error parsing reference: "[1836e4017c60]" is not a valid repository/tag: invalid reference format
[root@VM_0_4_centos ~]# docker tag niginx_my/nginx:v1 registry.cn-qingdao.aliyuncs.com/mysokou/soko_2:v1
[root@VM_0_4_centos ~]# docker push registry.cn-qingdao.aliyuncs.com/mysokou/soko_2:v1
The push refers to repository [registry.cn-qingdao.aliyuncs.com/mysokou/soko_2]
9e2c0a77e8a4: Pushed
579c75bb43c0: Pushed
67d3ae5dfa34: Pushed
8b15606a9e3e: Pushed
v1: digest: sha256:49768cfb207e5a133d62f3f5a7e59723e7a8c3a0d2c81e4155b34561f557adfc size: 1160

After the upload is successful, go to Alibaba's backend to check that the upload is successful.

Added DockerHUB upload method

My Mirror

After adding the tag, you can push it directly. I logged in before pushing it.

PS D:\Docker Toolbox> docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: sun2955
Password:
Login Succeeded

Push directly after login

PS D:\Docker Toolbox> docker tag nginx_my:0.1 sun2955/my_docker:v1
PS D:\Docker Toolbox> docker push sun2955/my_docker:v1

result:

The push refers to repository [docker.io/sun2955/my_docker]
88353f831c90: Pushed
f978b9ed3f26: Pushed
9040af41bb66: Pushed
7c7d7f446182: Pushed
d4cf327d8ef5: Pushed
13cb14c2acd3: Pushed
v1: digest: sha256:a7d0b9705e68a3c161174fb791656af8e85b1ed97d2a3342530763d55cf05482 size: 1569
PS D:\Docker Toolbox>
PS D:\Docker Toolbox>
PS D:\Docker Toolbox>

You can go to the backend to check the image and upload it successfully.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Analysis of Springboot microservice packaging Docker image process
  • A brief analysis of SpringBoot packaging and uploading to docker and implementing multi-instance deployment (IDEA version)
  • Explanation of the process of docker packaging node project
  • Detailed explanation of how to use Docker to deploy a web project and package it into an image file
  • Using jib to package docker images
  • Detailed explanation of Docker container basic system image packaging
  • How to implement packaging in docker python
  • Detailed explanation of Docker package python commands

<<:  The normal method of MySQL deadlock check processing

>>:  Vue3 AST parser-source code analysis

Recommend

javascript:void(0) meaning and usage examples

Introduction to void keyword First of all, the vo...

How to get the dynamic number of remaining words in textarea

I encountered a case at work that I had never wri...

Practical way to build selenium grid distributed environment with docker

Recently, I needed to test the zoom video confere...

What to do if you forget your password in MySQL 5.7.17

1. Add skip-grant-tables to the my.ini file and r...

Vue page monitoring user preview time function implementation code

A recent business involves such a requirement tha...

mysql obtains statistical data within a specified time period

mysql obtains statistical data within a specified...

Multiple ways to calculate age by birthday in MySQL

I didn't use MySQL very often before, and I w...

MySQL database constraints and data table design principles

Table of contents 1. Database constraints 1.1 Int...

Implementation example of Docker rocketmq deployment

Table of contents Preparation Deployment process ...

Sample code on how to implement page caching in vue mobile project

background On mobile devices, caching between pag...

Detailed explanation of nodejs built-in modules

Table of contents Overview 1. Path module 2. Unti...

Linux/Mac MySQL forgotten password command line method to change the password

All prerequisites require root permissions 1. End...