docker和docker-compose安装
# docker和docker-compose二进制安装
docker-compose下载地址
https://github.com/docker/compose/releases/download/1.27.4/docker-compose-Linux-x86_64
docker下载地址
Index of linux/static/stable/x86_64/ (opens new window)docker-compose下载地址
https://github.com/docker/compose/releases/download/1.27.4/docker-compose-Linux-x86_64
docker下载地址
docker.service启动服务文件
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service containerd.service
Wants=network-online.target
[Service]
Type=notify
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
StartLimitBurst=3
StartLimitInterval=60s
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
Delegate=yes
KillMode=process
[Install]
WantedBy=multi-user.target
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# yum安装社区版
# Fedora/CentOS/RHEL
以下内容根据 官方文档 (opens new window) 修改而来。
如果你之前安装过 docker,请先删掉
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
安装一些依赖
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
根据你的发行版下载repo文件:
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
最后安装:
sudo yum makecache
sudo yum install docker-ce
# debian12
配置清华源
cat > /etc/apt/sources.list << EOF
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
EOF
2
3
4
5
6
7
8
9
10
11
12
13
执行更新源
apt update
清华源docker地址:
https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/
安装docker之前需要添加 GPG 公钥,主要是用来验证安装文件是否被篡改,先安装工具:curl和gnupg2,两个工具。
apt install curl gnupg2
下面是清华源GPG地址,下载和添加。
curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/gpg |apt-key add -
配置清华源
vi /etc/apt/sources.list
在尾部添加清华源,bookworm代表debian12。stable代表发布分支,主要有三个:stable
(稳定版)、testing
(测试版)和 unstable
(不稳定版)。
deb https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian bookworm stable
更新库,然后安装
apt update
apt install docker-ce
2

