Docker four. Use Docker mirroring.

Source: Internet
Author: User
Tags docker ps docker hub docker run

Four Docker Use of mirrors

A Docker installation

1.1 Viewing the system version

[Email protected] ~]# cat/etc/redhat-release

CentOS Release 6.6 (Final)

1.2 using epel yum source

[Email protected]~] #rpm-IVH http://mirrors.yun-idc.com/epel/6/i386/epel-release-6-8.noarch.rpm

1.3 Installing Docker

[email protected] ~]# Yum install Docker-io

1.4 Start Docker

[Email protected] ~]#/etc/init.d/docker restart

two. using Mirroring

2.1 getting mirrors

Mirror is DOCKER  run premise   can use   docker pull command to download the image from the network. The format of the command is   docker pull name tag "  . For DOCKER  mirror   does not show the known latest tag download, Download the latest image in the repository.

Here's how to download an image of the latest centos os from the CentOS repository of the Docker hub

[email protected] ~]# Docker pull CentOS

The command actually downloads the centos:latest image. The latest version

You can also download a specific version of a mirror by using a label. For example , the image of a 6.5 Tag

Docker Pull centos:6.5

Download the image locally and use the image to create a container where you can run the bash app

[email protected] ~]# Docker run-t-I Centos:centos6/bin/bash

[Email protected]/]#

Indicates that it is inside the container , and the parameters behind the run are written.

2.2 viewing image information

Use the Docker images command to list the mirrors that are already on the local host.

[email protected] ~]# Docker images

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6B/FF/wKioL1U9mpXDgDwjAAFVekryquE737.jpg "title=" Picture 1.png "alt=" wkiol1u9mpxdgdwjaafvekryque737.jpg "/>

In the listing information, you can see several field information:

From that warehouse, for example : CentOS Warehouse

The label information for the image such as 6

ID Number of the mirror (unique)

Creation time.

Mirror size The ID information of the image is important, it uniquely marks the mirror

You can use the Docker inspect command to get the details of the image

[[email protected] ~]# Docker inspect f6808a3e4d9e syntax Docker inspect MAGE ID (aka Mirrored id )

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6C/03/wKiom1U9mdjw1rlWAAJjXpUFsNM607.jpg "title=" Picture 8.png "alt=" Wkiom1u9mdjw1rlwaajjxpufsnm607.jpg "/>

three. Search Image

3.1 uses the docker search command to search for shared mirrors in the remote repository, which is the default for the Docker Hub 's official image. Grammar

[[email protected] ~]# Docker search MySQL (mysql indicates the image to be searched) supported parameters include

--automated=false displays only the images that were created automatically.

--no-trunc=false output information does not truncate display

-S,--stars=0 means only images that are rated above the specified star rating are displayed

Quad Delete Mirror

Use the mirrored label to remove the image

You can use the Docker RMI command to remove the format of a mirrored command Docker RMI Tmage[inage] can use tags or ids

[email protected] ~]# Docker RMI 5B2FFF9306BD

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6C/03/wKiom1U9mbjBntdFAAFVekryquE258.jpg "style=" float: none; "title=" Image 6.png "alt=" Wkiom1u9mbjbntdfaafvekryque258.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6B/FF/wKioL1U9mx2j0QTdAAVvt9gjyIs389.jpg "style=" float: none; "title=" Image 7.png "alt=" Wkiol1u9mx2j0qtdaavvt9gjyis389.jpg "/>


·

If there is an exiting container in the background, attempting to delete the image will cause an error using the

Docker rmi-f image ID

-F means forced removal (not recommended with- F)

You can delete the container before removing the mirror

The command to delete a container is the ID of the Docker RM Container

The ID of the container can be viewed through Docker ps-a

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6B/FF/wKioL1U9mvOQgIfeAAGWG4MiZNk378.jpg "title=" Picture 5.png "alt=" Wkiol1u9mvoqgifeaagwg4miznk378.jpg "/>

Four. Save and load mirrors

4.1 can use the Docker save and docker load commands

To save a mirror

If you want to save the image to a local file, you can use the docker save command

[email protected] ~]# Docker save-o Centos.tar f6808a3e4d9e ( Idof the Mirror)

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6C/03/wKiom1U9mXniBKGFAACzAAeUlkU332.jpg "title=" Picture 4.png "alt=" wkiom1u9mxnibkgfaaczaaeulku332.jpg "/>

Load photographed like

can use Docker load is imported from a local file into a local mirror library, such as a centos.tar import image to a local mirror library

[email protected] ~]# Docker load--input Centos.tar

Or

[[email protected] ~]# Docker load < Centos.tar

Five. upload Image

You can upload the image to the repository using the Docker push command, which is uploaded to the dockerHub official repository By default (login required)

Syntax for commands Docker push Name[:tag]

Docker Tag Centos:centos6

When you first use, you will be prompted to enter your login information or register


Docker four. Use Docker mirroring.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.