Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed explanation of Common commands in Docker Warehouse

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Log in

Docker login

Complete the registration and login by entering the user name, password, and mailbox by executing the docker login command. After successful registration, the user authentication information will be stored in the .dockercfg of the local user directory.

Pull the image from the warehouse

Docker pull [Mirror name]

Search for an image

Docker search [Mirror name you want to search]

For example:

C:\ Users\ kunta > docker search centosNAME DESCRIPTION STARS OFFICIAL AUTOMATEDcentos The official build of CentOS. 5605 [OK] ansible/centos7-ansible Ansible on Centos7 123 [OK] jdeathe/centos-ssh OpenSSH / Supervisor / EPEL/IUS/SCL Repos-… [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 be divided into two categories according to whether the mirror image is provided by the official or not. One is a base image like centos, which is called a base or root image. These images are created, verified, supported and provided by Docker.

The other is a type of image like ansible/centos7-ansible, which is provided by other unofficial users or organizations, usually by adding some features to the basic image and then submitting it for release. Like the ansible/centos7-ansible image, it is maintained by a user or organization named ansible, with a user name prefixed to indicate that it is a user's repository.

Automatic creation

The automatic creation (Automated Builds) feature is very convenient for frequently upgrading programs in the image. Sometimes, the user creates an image, installs some software, and needs to update the image manually if a new version of the software is released.

The automatic creation feature allows users to specify through DockerHub to track projects on target websites (currently supporting GitHub or BitBucket), and automatically execute creation once the project finds a new submission.

To configure automatic creation, include the following steps:

Create and log in to Docker Hub, as well as the target website; * connect the account to the Docker Hub in the target site. Configure an automatic creation in Docker Hub. Select a project (which needs to contain Dockerfile) and branches in a target site. Specify the location of the Dockerfile and submit for creation.

You can then track the status of each creation on the automatic creation page of DockerHub.

Create and use private repositories,

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

Docker run-d-p 5000 registry

If no corresponding image is found locally when the docker run command is executed, the image will be pulled first and then run.

By default, the warehouse is created in the / tmp/registry directory of the container. You can use the-v parameter to store the image file on the specified path locally.

For example, the following example places the uploaded image in the / opt/data/registry directory:

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

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

Actual combat

First, set up a private warehouse on a server machine, whose address is 10.0.2.2 virtual 5000. Then try to upload and download the image from the computer.

View existing images locally:

C:\ Users\ kunta > docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEhub.c.163.com/kuntang/lingermarket latest c7a70a3810cf 23 months ago 418MBubuntu2 16.04 1196ea15dad6 2 years ago 336MBubuntu latest 1196ea15dad6 2 years ago 336MBhub.c.163.com/public/ubuntu 16.04-tools 1196ea15dad6 2 years ago 336MBhub.c.163. Com/public/centos 6.7-tools b2ab0ed558bb 2 years ago 602MB

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

Docker tag ubuntu2:16.04 10.0.2.2:5000/testdocker 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 a private repository

Curl http://10.0.2.2:5000/v1/search

You can see that the mirror was successful last time.

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

Docker pull 10.0.2.2:5000/test

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report