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 resources Official

A: active installation

sudo apt-get remove docker docker-engine
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
curl -fsSL | 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 | sh -

B: passive installation

Download first. Compiler package.

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);):

dpkg -i *.deb

Docker compose installation

We can use docker compose to manage multiple containers.

Offline installation:

wget`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:

tar xvf harbor-offline-installer-v1.6.0-rc3.tgz
cd harbor

Edit docker-compose.yml:

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

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

vim common/templates/registry/config.yml

    issuer: harbor-token-issuer
    realm: $public_url:8888/service/token
    rootcertbundle: /etc/registry/root.crt
    service: harbor-registry

Edit harbor.cfg:

hostname =
harbor_admin_password = admin

Launch and log in:

sudo su
ufw allow 8888
docker-compose up -d

Open: : 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": [""],
  "insecure-registries": [""]
sudo systemctl daemon-reload
sudo systemctl restart docker

Then log in to push:

sudo docker login
sudo docker tag mysql:5.7
docker push

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

Tags: Linux Docker sudo Ubuntu Nginx

Posted on Tue, 03 Dec 2019 21:18:49 -0500 by ririe44