Complete set of installation documents and small skills of Docker related environment

The following environments are Ubuntu 16.04, which mainly install docker, docker compose, docker warehouse, etc. Docker installation Reference resourc...
Docker installation
Docker compose installation
Docker Hub installation
Docker configuration
Docker specific scenario use

The following environments are Ubuntu 16.04, which mainly install docker, docker compose, docker warehouse, etc.

Docker installation

Reference resources Official

A: active installation

sudo apt-get remove docker docker-engine docker.io sudo apt-get update sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo apt-key fingerprint 0EBFCD88 sudo apt-get update apt-cache madison docker-ce sudo apt-get install docker-ce=docker-ce=18.03.0~ce-0~ubuntu sudo docker run hello-world

You can also use this script to install:

sudo curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -

B: passive installation

Download first. Compiler package.

wget https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/docker-ce_18.06.1~ce~3-0~ubuntu_amd64.deb sudo dpkg -i docker-ce_18.06.1~ce~3-0~ubuntu_amd64.deb sudo docker run hello-world

After March 1, 2017, the naming of Docker's version began to change. At the same time, CE version and EE version were separated. 18.03 means that it was released in March, 2018.

Docker before offline installation and naming (docker engine depends on libltdl7 (> = 2.4.6);):

wget https://apt.dockerproject.org/repo/pool/main/d/docker-engine/docker-engine_1.12.1-0~xenial_amd64.deb wget http://archive.ubuntu.com/ubuntu/pool/main/libt/libtool/libltdl7_2.4.6-4_amd64.deb dpkg -i *.deb

Docker compose installation

We can use docker compose to manage multiple containers.

Offline installation:

wget https://github.com/docker/compose/releases/download/1.8.1/docker-compose-`uname -s`-`uname -m` mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose

Docker Hub installation

Open source enterprise Docker Registry management project of VMware company: harbor.

With the warehouse, we can push the image directly, and then pull it from other places without using the U disk.

Installation reference: OfficialArticle

The environment depends on the newer docker 1.10 + and docker-compose1.60 + and python2.7. We choose the offline installation mode:

wget https://storage.googleapis.com/harbor-releases/release-1.6.0/harbor-offline-installer-v1.6.0-rc3.tgz tar xvf harbor-offline-installer-v1.6.0-rc3.tgz cd harbor

Edit docker-compose.yml:

proxy: image: goharbor/nginx-photon:v1.6.0 container_name: nginx restart: always volumes: - ./common/config/nginx:/etc/nginx:z networks: - harbor ports: - 8888:80 - 1443:443 - 4443:4443

Modify the file common/templates/registry/config.yml to add port 8888:

vim common/templates/registry/config.yml auth: token: issuer: harbor-token-issuer realm: $public_url:8888/service/token rootcertbundle: /etc/registry/root.crt service: harbor-registry

Edit harbor.cfg:

hostname = 192.168.152.12 harbor_admin_password = admin

Launch and log in:

sudo su ufw allow 8888 ./prepare docker-compose up -d

Open: http://192.168.152.12 : 8888, account No. | password: admin

Docker configuration

You can configure some warehouse addresses (the first is Alibaba cloud accelerated warehouse address, and the second is https security ignored)

sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://ztndgg1k.mirror.aliyuncs.com"], "insecure-registries": ["192.168.0.88:8888"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker

Then log in to push:

sudo docker login http://192.168.0.88:8888 sudo docker tag mysql:5.7 192.168.0.88:8888/public/mysql:5.7 docker push 192.168.0.88:8888/public/mysql:5.7

Docker specific scenario use

Offline mirroring

If you cannot access the Internet, you can use save and load to save and load the image

docker save xxx:1.0 > /root/api1.0.tar docker load < /root/api1.0.tar docker images

3 December 2019, 21:18 | Views: 4283

Add new comment

For adding a comment, please log in
or create account

0 comments