Installation of private docker warehouse shell version or download the latest version of the specified way

Summary:

Although the country has had a lot docker accelerated mirroring, previously used daocloud, recently found Ali cloud.

But private network deployment kubernetes, does not take to accelerate the mirror, or are you a better deployment.

A: Installation docker docker-compose

docker things at home or with a docker deployment.

First, install and docker docker-compose.

Fedora previously used when direct dnf install it.

Now with centos, it costs just a little effort.

# Step 1: Some systems tools necessary to install 
the sudo yum the install yum-utils -Y-persistent-Device-Mapper Data LVM2 
# the Step 2: Add the software source information 
sudo yum-config-manager --add- repo http: // mirrors .aliyun.com / Docker-CE / Linux / CentOS / Docker-ce.repo 
# the Step. 3: update and install the CE-Docker 
the sudo yum makecache FAST 
the sudo yum the install Docker -Y-CE 
# the Step. 4: service open Docker 
sudo service docker start 

Note: additional considerations in comments below 
# the latest official software source software is enabled by default, you can get various versions of the package by way of editing software source. For example, the official did not test version of the software source set is available, you can turn in the following manner. Similarly you can open various test version. 
Vim /etc/yum.repos.d/docker-ce.repo # 
# enabled is below [docker-ce-test] = 0 is modified. 1 = enabled 
# 
# install the specified version of the CE-Docker: 
# the Step. 1: Find Docker-CE version: 
# yum List Docker-ce.x86_64 --showduplicates | the Sort -r
Loading SPEEDS from cached Mirror # hostfile 
# Loaded plugins: Branch, fastestmirror, the Langpacks 
# Docker-ce.x86_64 17.03.1.ce-1.el7.centos Docker-ce-stable 
# Docker-ce.x86_64 17.03.1.ce- @ Docker-CE-1.el7.centos the stable 
# Docker Docker-ce.x86_64 17.03.0.ce-1.el7.centos the stable-CE- 
# the Available the Packages 
# Step2: install the specified version Docker-CE: (vERSION e.g. the above 17.03.0.ce.1-1.el7.centos) 
# Docker the install the sudo yum -Y-CE- [vERSION] 
# Note: after some versions, docker-ce there are other dependencies installed, if the installation fails please pay attention to the error message. For example, after 17.03, you need to install docker-ce-selinux docker-ce . 
List yum-ce Docker #-selinux- --showduplicates | the Sort -r 
# sudo yum -y install Docker-ce-selinux- [VERSION]

# By classical network, network system installed within the VPC, Step 2 replacing the command in the command  
# classic network:
# sudo yum-config-manager --add -repo http://mirrors.aliyuncs.com/docker-ce/linux/centos /docker-ce.repo 
# VPC network: 
# sudo yum-config-Manager --add-repo http://mirrors.could.aliyuncs.com/docker-ce/linux/centos/docker-ce.repo

II: Installation docker-compose

This is what I use the most stand-alone container scheduling management software.

But there's no centos precompiled packages.

To the official installation instructions: 1.24.1

curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

 Next time how to install the latest version of it?

Combined with the shell version or download the latest version of the specified way

Batch re-write it

#! / bin / the bash 

# begin installation 
echo the Install the Dependency Packages 

# install dependencies JQ 
curl -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -o / usr / local / bin / JQ 
the chmod + X / usr / local / bin / JQ 

# install additional dependencies 
the sudo yum yum the install -Y-utils \ 
  Device-Mapper-persistent-Data \ 
  LVM2 \ 
  curl 
  
# Ali added docker-ce source 
sudo yum- --add the repo-Manager-config http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 

# install and update the CE-Docker 
the sudo yum makecache FAST && 
     yum the install Docker -Y-CE 

# enable Docker service 
sudo && systemctl Start systemctl enable Docker Docker 

# jq updated
VER=$(curl -s https://api.github.com/repos/stedolan/jq/releases/latest | grep tag_name | cut -d '"' -f 4)
URL=$(curl -s https://api.github.com/repos/stedolan/jq/releases/tags/${VER} | jq .assets[2].browser_download_url | tr -d \")
curl -L $URL -o /usr/local/bin/jq
chmod +x /usr/local/bin/jq

#安装最新版docker-compose
VER=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d '"' -f 4)
URL=$(curl -s https://api.github.com/repos/docker/compose/releases/tags/${VER} | jq .assets[2].browser_download_url | tr -d \")
curl -L $URL -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose


echo Congratulations. You install docker-ce docker-compose is Successful completion.

Three: choreography yaml

 

version: "3" #版本3
services: #服务
  registry:
    image: registry:latest
    container_name: registry
    privileged: true
    restart: always
    ports:
    - 5000:5000
    volumes:
    - /storage/docker_registry:/var/lib/registry

 Save as registry.yaml

Four: Start container

docker-compose -f registry.yaml up -d

Five: Test Access

Open your browser and access http://127.0.0.1:5000/v2/_catalog, you can view { "repositories": []} represents the warehouse now, there is no mirror images

six:

Seven:

Eight:

nine:

ten:

--- end --- restore content

Guess you like

Origin www.cnblogs.com/jackadam/p/11265860.html