文章目录
- 一. 离线安装
- 1. 下载docker
- 2. 安装
- 二. 相关命令
- 三. 配置docker-compose
一. 离线安装
1. 下载docker
wget https://download.docker.com/linux/static/stable/x86_64/docker-27.1.2.tgz wget https://download.docker.com/linux/static/stable/aarch64/docker-27.1.2.tgz
2. 安装
tar -zxvf docker-27.1.2.tgzsudo cp docker/* /usr/bin/
将docker注册成系统服务;
vim /etc/systemd/system/docker.service[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
### 增加可执行权限
chmod +x /etc/systemd/system/docker.service
systemctl daemon-reload ### 设置开机自启动
systemctl enable docker.service### 启动 docker
systemctl start docker### 测试 docker 是否启动
docker --versiondocker run hello-world### 停止 docker
sudo systemctl stop docker
二. 相关命令
### 镜像源
vim /etc/docker/daemon.json
# 例如
{"registry-mirrors": ["https://dockerproxy.com","https://hub-mirror.c.163.com","https://mirror.baidubce.com","https://ccr.ccs.tencentyun.com"]
}### 重新启动服务
sudo systemctl daemon-reload
sudo systemctl restart docker### 查看配置
docker info
三. 配置docker-compose
cp docker-compose-linux-x86_64 /usr/bin/docker-compose
chmod +x /usr/bin/docker-compose
docker-compose --version