Detailed explanation of common commands in Docker repository

Detailed explanation of common commands in Docker repository

Log in

docker login

Complete the registration and login by executing the docker login command and entering the username, password, and email address. After successful registration, the user authentication information will be saved in the .dockercfg file in the local user directory.

Pull the image from the repository

docker pull [image name]

Search Mirror

docker search [image name to search]

For example:

C:\Users\kunta>docker search centos
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
centos The official build of CentOS. 5605 [OK]       
ansible/centos7-ansible Ansible on Centos7 123 [OK]
jdeathe/centos-ssh OpenSSH / Supervisor / EPEL/IUS/SCL Repos - … 113 [OK]
consol/centos-xfce-vnc Centos container with "headless" VNC session… 99 [OK]
centos/mysql-57-centos7 MySQL 5.7 SQL database server 63                  
imagine10255/centos6-lnmp-php56 centos6-lnmp-php56 57 [OK]
tutum/centos Simple CentOS docker image with SSH access 45                  
centos/postgresql-96-centos7 PostgreSQL is an advanced Object-Relational ... 39                 
kinogmt/centos-ssh CentOS with SSH 29

We can divide the images into two categories based on whether they are officially provided. One is a base image like centos, called a base or root image. These images are created, verified, supported, and provided by Docker.

The other type is an image like ansible/centos7-ansible, which is provided by other unofficial users or organizations. Generally, some features are added to the basic image and then submitted for release for everyone to use. For example, the ansible/centos7-ansible image is maintained by a user or organization named ansible and has a username as a prefix, indicating that it is a repository for a certain user.

Automatic creation

The Automated Builds feature is very convenient for frequently upgrading programs in the image. Sometimes, a user creates an image and installs a certain software. If a new version of the software is released, the image needs to be manually updated.
The automatic creation function allows users to specify a project on a target website (currently supports GitHub or BitBucket) for tracking through DockerHub. Once a new submission is found in the project, it will be automatically created.

To configure automatic creation, follow these steps:

  1. Create and log in to Docker Hub, and the target website; * Connect your account to Docker Hub in the target website.
  2. Configure an automatic build in Docker Hub.
  3. Select a project (including Dockerfile) and branch in the target website.
  4. Specify the location of the Dockerfile and submit the build.

Afterwards, you can track the status of each build in the Automatic builds page in DockerHub.

Creating and using private repositories,

After installing Docker, you can easily build a local private warehouse environment through the official registry image:

docker run -d -p 5000:5000 registry

When the docker run command is executed, if it is found that there is no corresponding image locally, it will first pull the image and then run it.

By default, the repository is created in the /tmp/registry directory of the container. The -v parameter can be used to store the image file in a specified local path.
For example, the following example puts the uploaded image into the /opt/data/registry directory:

docker run -d -p 5000:5000 -v /opt/data/registry:/tmp/registry registry

At this point, a private warehouse service will be started locally, listening on port 5000.

Actual Combat

First, build a private warehouse on a server machine, whose address is 10.0.2.2:5000. Then try to upload and download the image from the machine.
Check the existing images locally:

C:\Users\kunta>docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hub.c.163.com/kuntang/lingermarket latest c7a70a3810cf 23 months ago 418MB
ubuntu2 16.04 1196ea15dad6 2 years ago 336MB
ubuntu latest 1196ea15dad6 2 years ago 336MB
hub.c.163.com/public/ubuntu 16.04-tools 1196ea15dad6 2 years ago 336MB
hub.c.163.com/public/centos 6.7-tools b2ab0ed558bb 2 years ago 602MB

Use the docker tag command to mark the image repository as a private repository machine address (the format is: docker tag IMAGE[:TAG] [REGISTRYHOST/]NAME[:TAG]):

docker tag ubuntu2:16.04 10.0.2.2:5000/test
docker images

Use the docker push command to upload the image:

docker push 10.0.2.2:5000/test

Use curl to view the image of the private warehouse

curl http://10.0.2.2:5000/v1/search

It can be seen that the mirroring was successful last time.

Now you can download this image from any machine that can access the 10.0.2.2 address:

docker pull 10.0.2.2:5000/test

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:
  • Detailed explanation of common commands for network configuration of containers in Docker
  • Summary of common commands in Dockerfile
  • Docker common commands summary (practical version)
  • Summary of Docker's commonly used commands for clearing container images
  • Detailed explanation of common Docker commands

<<:  Use PHP's mail() function to send emails

>>:  Detailed explanation of the interaction between React Native and IOS

Recommend

jQuery implements clicking left and right buttons to switch pictures

This article example shares the specific code of ...

How to hide the version number and web page cache time in Nginx

Nginx optimization---hiding version number and we...

How InnoDB cleverly implements transaction isolation levels

Preface In the previous article Detailed Explanat...

Using an image as a label, the for attribute does not work in IE

For example: Copy code The code is as follows: <...

100 ways to change the color of an image using CSS (worth collecting)

Preface “When it comes to image processing, we of...

Summary of WEBAPP development skills (notes for mobile website development)

1. To develop web responsively, the page must ada...

Detailed explanation of Vue's hash jump principle

Table of contents The difference between hash and...

Design: A willful designer

<br />Years of professional art design educa...

Detailed tutorial on installing Docker on CentOS 7.5

Introduction to Docker Docker is an open source c...

Tutorial on binary compilation and installation of MySql centos7 under Linux

// It took me a whole afternoon to install this, ...

Detailed explanation of how to enter and exit the Docker container

1 Start the Docker service First you need to know...

Native js implementation of slider interval component

This article example shares the specific code of ...

Eight hook functions in the Vue life cycle camera

Table of contents 1. beforeCreate and created fun...

How to install iso file in Linux system

How to install iso files under Linux system? Inst...

MySQL query optimization using custom variables

Table of contents Optimizing sorting queries Avoi...