Docker imagines the container and uploads it

Introduction: This is the third article I participated in for beginners. When using Docker, it is often necessary to make an image of the container with a well-configured environment and upload it to DockerHub for later retrieval. This article describes how to image a Docker container and upload it to DockerHub.

View the list of containers

The first is to view the container: type the docker ps -a command in the command console, and you get the following interface.

Create a new image from the container

Next, the dockers commit container name is the image name to be saved as: version name (default: latest if not: version name)

Note: The docker commit command creates a new image from the container.

For example, docker commit vser vs:v1

Label the image

Now that we have successfully completed the above steps, we need to label the mirror with the following syntax:

docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]

Example: docker tag vs:v1 CCCC /vserver:v1 docker user name/repository name created on dockerHub: version number (default: latest)

Upload the image

Next, we need to upload the tagged image to Docker Hub with the upload command:

docker push [OPTIONS] NAME[:TAG]

Docker push: To upload the local image to the image repository, log in to the image repository first.

Example: Docker push CCCC /vserver:v1 Pull the image to the image repository. After completion, the following output is displayed:

The upload is successful. Then you can go to Docker Hub to see if the upload was successful.