美文网首页
离线安装docker、docker-compose

离线安装docker、docker-compose

作者: bit_拳倾天下 | 来源:发表于2022-05-10 09:12 被阅读0次

1. 安装docker

1.1 下载 docker 安装包

下载地址:https://download.docker.com/linux/static/stable/

1.2 安装 docker

  1. 解压
[harbor@Qh-harbor /]$ sudo tar -zxvf docker-20.10.7.tgz 
docker/
docker/docker-proxy
docker/containerd
docker/dockerd
docker/docker
docker/containerd-shim-runc-v2
docker/ctr
docker/docker-init
docker/runc
docker/containerd-shim
  1. 复制
sudo cp -p docker/* /usr/bin
  1. 配置 service
# 或 vi /usr/lib/systemd/system/docker.service,根据实际情况
sudo vi /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
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
  1. 配置文件
[harbor@Qh-harbor etc]$ sudo mkdir docker
[harbor@Qh-harbor etc]$ sudo vi /etc/docker/daemon.json
{
    # 执行工作路径
    "data-root": "/data/docker"
}
# 配置文件生效
sudo systemctl daemon-reload
# 开启自启
sudo systemctl enable docker
# 启动 docker
sudo systemctl start docker

2. 安装 docker-compose

2.1 下载

下载地址:https://github.com/docker/compose/releases

2.2 安装

下载离线包

sudo mv docker-compose-linux-x86_64.bin  /usr/bin/docker-compose
sudo chmod +x  /usr/bin/docker-compose

检查是否安装成功

[harbor@Qh-harbor bin]$ docker-compose -v
Docker Compose version v2.5.0

相关文章

网友评论

      本文标题:离线安装docker、docker-compose

      本文链接:https://www.haomeiwen.com/subject/rddzyrtx.html