docker Installation and Getting Started

Copyright: code word is not easy, please indicate the source ~~ https://blog.csdn.net/m0_37190495/article/details/91572437
Reproduced, please indicate the source:
Original starting in: http://www.zhangruibin.com
article from RebornChang's blog

docker

docker installation

docker knowledge

Use vagrant

Use vagrant can effectively manage configuration services, customized vagrantFileto achieve a unified multi-machine deployment.
The default configuration sshfor Free-tight connection is not the default and rootthe user.

Initialization file

        
        
        $ vagrant init centos/7

      

start up

        
        
        $ vagrant up

      

Enter the service

        
        
        $ vagrant ssh

      

View Status

        
        
        $ vagrant status

      

Shutdown

        
        
        $ vagrant half

      

delete

        
        
        $ vagrant destroy

      

Installation docker

Red Hat-based server cleanup work to do first, if you already have installed the uninstall to avoid subsequent errors.

        
        
        $ sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

      

Installation dependencies

        
        
        $ sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

      

Add docker stable version of the source

        
        
        $ sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

      

Docker install the latest version

        
        
        $ sudo yum install docker-ce -y

      

Start docker Service

        
        
        $ sudo systemctl start docker

      

Run a hello worldvalidation docker is available.

        
        
        $ sudo docker run hello-world

      

Simple use of docker

Query Mirror

docker search centos7
query results are as follows

Download image

docker pull ansible/centos7-ansible

Run-time image

docker run -ti ansible/centos7-ansible

Modify the default image

Cd into the mirror to the root directory, create a folder app

cd /
mkdir app

Exit Mirror

exit

Query mirror (to modify the exit status of the mirror) just ran

docker ps -l

Suppose the query to the image id is: 5a9e468a19f6

Id just run to get an increase of TAG saved locally

Just run the query details mirroring:

检查运行中的镜像
$docker inspect 5a9e468a19f6

Assuming docker ps query to the id of 5a9e468a19f6
parameters: -l final
-a run through all of
it:

docker commit 5a9e468a19f6 rebornchang/centos7:v2

At this point the query will be more local docker mirror found out rebornchang / centos7 version v2

查询命令
docker images

Their modified docker docker image upload to your warehouse

First register their docker club account

Registered Address: https://cloud.docker.com/

Creating a warehouse

For example bloggers registered account name is rebornchang, created a repository called centos7, open.

After creating a warehouse execute commands on the host of the installation docker:

查看镜像:
docker images

End view mirror as shown below:

can see there are a REPOSITORY: rebornchang / centos7, TAG and v4 is.
At this point we log docker warehouse;

docker login
然后对应输入账号密码。就将docker远程账号和本地关联起来了

You can also modify the tag specified mirroring

$docker tag rebornchang/centos7:v4 rebornchang/centos7:latest

Sometimes the mirror is REPOSITORY and TAG, found the mirror ID is assumed to be 1a2w3e4r can use this command to modify

$docker tag 1a2w3e4r rebornchang/centos7:latest

Note: mirrored REPOSITORY name is the name of a remote repository docker, Tag is equivalent to a stand-alone version of the label, Tag do the same.

Upload local mirroring to a remote warehouse

 docker push rebornchang/centos7:v4
 The push refers to repository [docker.io/rebornchang/centos7]
 8a8f10ffd124: Pushed 
 5a9e468a19f6: Layer already exists 
 cf4eb7184a66: Layer already exists 
 596e51307fcb: Layer already exists 
 7794e20d52b7: Layer already exists 
 f8c414e271fb: Layer already exists 
 0d1585b29470: Layer already exists 
 34e7b85d83e4: Layer already exists 
 v4: digest: sha256:3d6eae11c751df9dc61d543247d86937420e902705b9c4b37bcf7ee18bfb5d73 size: 1988

This time on a web page query the remote repository you can see the push over the mirrored:

PS: This article will first come here, follow-up will update the build environment they need in the mirror.

PPS: bloggers this article before half Mao blogger sent me, I brought directly made, Who hair bloggers say so I said I docker's blog yet.

Guess you like

Origin blog.csdn.net/m0_37190495/article/details/91572437