Timetombs

泛义的工具是文明的基础,而确指的工具却是愚人的器物

66h / 117a
,更新于 2024-12-21T13:29:20Z+08:00 by   2255bb5

[Docker] Install

版权声明 - CC BY-NC-SA 4.0

1 dokcerd

reference: https://docs.docker.com/engine/reference/commandline/dockerd/

1.1 Ubuntu

# wget https://linianhui.github.io/docker/install/docker-on-ubuntu.sh
# sudo bash install.docker-on-ubuntu.sh

set -eux

apt remove -y docker docker-engine docker.io

apt update -y

apt install -y apt-transport-https ca-certificates curl software-properties-common

curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add -

apt-key fingerprint 0EBFCD88

add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

apt update -y
apt install -y docker-ce

groupadd docker

systemctl enable docker

docker version

1.2 CentOS

# wget https://linianhui.github.io/docker/install/docker-on-centos.sh
# sudo bash install.docker-on-centos.sh

set -eux

yum remove -y docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine

yum install -y yum-utils device-mapper-persistent-data lvm2

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

yum install -y docker-ce

groupadd docker

systemctl enable docker

docker version

1.3 Debian

# wget https://linianhui.github.io/docker/install/docker-on-debian.sh
# sudo bash install.docker-on-debian.sh

set -eux

apt remove -y docker docker-engine docker.io

apt update -y

apt install -y apt-transport-https ca-certificates curl software-properties-common gnupg1 gnupg2

curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/debian/gpg | apt-key add -

add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/debian $(lsb_release -cs) stable"

apt update -y
apt install -y docker-ce

groupadd docker

systemctl enable docker

docker version

1.4 Config dockerd

https://docs.docker.com/engine/reference/commandline/dockerd/

# wget https://linianhui.github.io/docker/install/config-dockerd.sh
# sudo bash config-dockerd.sh

set -eux
# https://docs.docker.com/engine/reference/commandline/dockerd//#daemon-configuration-file

mkdir /etc/docker

wget -O /etc/docker/daemon.json https://linianhui.github.io/docker/install/daemon.json

cat /etc/docker/daemon.json

systemctl daemon-reload
systemctl restart docker

docker info
{
  "data-root": "/data/dockerd",
  "debug": true,
  "default-shm-size": "64M",
  "exec-opts": [
    "native.cgroupdriver=systemd"
  ],
  "group": "docker",
  "hosts": [
    "unix:///var/run/docker.sock",
    "tcp://0.0.0.0:2375"
  ],
  "insecure-registries": [
    "registry.test"
  ],
  "ip": "0.0.0.0",
  "ip-forward": true,
  "ipv6": false,
  "log-driver": "json-file",
  "log-level": "info",
  "log-opts": {
    "max-file": "5",
    "max-size": "32m"
  },
  "max-concurrent-downloads": 6,
  "max-concurrent-uploads": 6,
  "registry-mirrors": [
    "http://hub-mirror.c.163.com/",
    "https://docker.mirrors.ustc.edu.cn"
  ],
  "storage-driver": "overlay2",
  "tls": false
}

2 docker

https://docs.docker.com/engine/install/binaries/

Windows : https://download.docker.com/win/static/stable/x86_64

MacOS : https://download.docker.com/mac/static/stable/x86_64/

xattr -d com.apple.quarantine docker

reference : https://docs.docker.com/engine/reference/commandline/cli/

3 dokcer-compose

https://github.com/docker/compose/releases

# wget https://linianhui.github.io/docker/install/docker-compose.sh
# sudo bash install.docker-compose.sh

set -eux

curl -L https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-$(uname -s)-$(uname -m) \
     -o /usr/local/bin/docker-compose

chmod +x /usr/local/bin/docker-compose

docker-compose --version

reference : https://docs.docker.com/compose/reference/

4 dokcer-machine

# wget https://linianhui.github.io/docker/install/docker-machine.sh
# sudo bash install.docker-machine.sh

set -eux

curl -L https://github.com/docker/machine/releases/download/v0.16.1/docker-machine-$(uname -s)-$(uname -m) \
     -o /usr/local/bin/docker-machine

chmod +x /usr/local/bin/docker-machine

docker-machine --version

5 reference

https://docs.docker.com/install/linux/docker-ce/ubuntu/

https://docs.docker.com/install/linux/docker-ce/centos/

https://docs.docker.com/compose/install

https://docs.docker.com/machine

https://github.com/docker/compose/releases

https://github.com/docker/machine/releases/

https://github.com/boot2docker/boot2docker/releases

下一篇 : [Docker] Best Practice