下载
docker二进制包获取地址:https://download.docker.com/linux/static/stable/x86_64/
1 2
| $ tar -zxvf docker*.tgz $ cp docker/* /usr/bin
|
Go to https://download.docker.com/linux/debian/dists/
.
Select your Debian version in the list.
Go to pool/stable/
and select the applicable architecture (amd64
, armhf
, arm64
, or s390x
).
Download the following deb
files for the Docker Engine, CLI, containerd, and Docker Compose packages:
containerd.io_<version>_<arch>.deb
docker-ce_<version>_<arch>.deb
docker-ce-cli_<version>_<arch>.deb
docker-buildx-plugin_<version>_<arch>.deb
docker-compose-plugin_<version>_<arch>.deb
Install the .deb
packages. Update the paths in the following example to where you downloaded the Docker packages.
1 2 3 4 5
| $ sudo dpkg -i ./containerd.io_<version>_<arch>.deb \ ./docker-ce_<version>_<arch>.deb \ ./docker-ce-cli_<version>_<arch>.deb \ ./docker-buildx-plugin_<version>_<arch>.deb \ ./docker-compose-plugin_<version>_<arch>.deb
|
json
daemon.json
1 2 3 4 5 6 7 8 9 10 11 12 13
| cat >> /etc/docker/daemon.json <<EOF { "data-root": "/home/cs/data/docker", "registry-mirrors" : [ "http://hub-mirror.c.163.com" ], "insecure-registries":[ "https://k8s.org" ], "debug" : true, "experimental" : true } EOF
|
proxy
CLI
https://docs.docker.com/engine/cli/proxy/
~/.docker/config.json
通过容器中的环境变量使用代理
1 2 3 4 5 6 7 8
| { "proxies":{ "default": { "httpProxy": "http://127.0.0.1:7897", "httpsProxy": "https://127.0.0.1:7897", "noProxy": "localhost,127.0.0.1,192.0.0.0/8,*.local.org,k8s.org" } }
|
daemon
/etc/docker/daemon.json
1 2 3 4 5 6 7 8
| , "proxies":{ "http-proxy": "http://127.0.0.1:7897", "https-proxy": "https://127.0.0.1:7897", "no-proxy": "localhost,127.0.0.1,192.0.0.0/8,*.local.org,k8s.org" }
sudo systemctl restart docker
|
service
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| cat >>/usr/lib/systemd/system/docker.service <<EOF [Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com After=network-online.target firewalld.service Wants=network-online.target
[Service] Type=notify ExecStart=/usr/bin/dockerd ExecReload=/bin/kill -s HUP $MAINPID LimitNOFILE=infinity LimitNPROC=infinity TimeoutStartSec=0 Delegate=yes KillMode=process Restart=on-failure StartLimitBurst=3 StartLimitInterval=60s
[Install] WantedBy=multi-user.target EOF
|
开始
1 2 3 4 5 6 7
| systemctl daemon-reload systemctl enable --now docker
cat /etc/group | grep ^docker #不存在 sudo groupadd docker #存在忽略,创建组 sudo gpasswd -a ${USER} docker #添加当前用户到组 sudo restart #重启生效
|
compose
https://ghproxy.com/
1 2 3 4
| $ curl -L https://github.com/docker/compose/releases/download/v2.15.1/docker-compose-linux-x86_64 $ docker compose version Docker Compose version v2.15.1
|
当前用户 docker-composeand copy it to
$HOME/.docker/cli-plugins
所有用户 /usr/local/lib/docker/cli-plugins/docker-compose
原有的“docker-compose 命令不再使用
私库
harbor安装
sudo bash /opt/ansible/bak/harbor.sh
1 2 3 4 5 6 7 8
| $ sudo mkdir -p /etc/docker/certs.d/k8s.org $ sudo cp /opt/kubernetes/harbor/k8s.org/{k8s.org*,ca.crt} /etc/docker/certs.d/k8s.org $ ls -l /etc/docker/certs.d/k8s.org 总用量 12 -rw-r--r-- 1 root root 1968 2月 28 21:22 ca.crt -rw-r--r-- 1 root root 2004 2月 28 21:22 k8s.org.cert -rw------- 1 root root 3243 2月 28 21:22 k8s.org.key $ sudo systemctl status docker
|
点击打赏
会心一笑