【docker】docker 、docker-compose离线安装
docker 、docker-compose 离线 安装
·
一、离线安装docker
docker、docker-compose 百度盘
链接:https://pan.baidu.com/s/1eME67PmV8HzpgtfCHVU-pA
提取码:t8d4
链接:https://pan.baidu.com/s/1eMwepKEH3-QBlTFYVqqtwQ
提取码:19vc
--来自百度网盘超级会员V3的分享
1. 下载docker安装包
官方地址:
https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz
2.解压缩
tar -zxvf docker-20.10.9.tgz
[root@centos247 docker]# tar -zxvf docker-20.10.9.tgz
docker/
docker/containerd-shim-runc-v2
docker/dockerd
docker/docker-proxy
docker/ctr
docker/docker
docker/runc
docker/containerd-shim
docker/docker-init
docker/containerd
3. 解压的docker文件夹全部移至/usr/bin目录
cp -p docker/* /usr/bin
4. 将docker注册为系统服务
① 在/usr/lib/systemd/system/目录下,创建docker.service文件
② 编辑docker.service文件
vim /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target docker.socket firewalld.service containerd.service time-set.target
Wants=network-online.target containerd.service
Requires=docker.socket
[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
# 2023-11-8 22:44:37 add -H tcp://0.0.0.0:2375 DJCKING
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.0:2375
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutStartSec=0
RestartSec=2
Restart=always
# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
# Both the old, and new location are accepted by systemd 229 and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst=3
# Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s
# 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
# Comment TasksMax if your systemd version does not support it.
# Only systemd 226 and above support this option.
TasksMax=infinity
# 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
OOMScoreAdjust=-500
[Install]
WantedBy=multi-user.target
5. 重启生效
重启守护进程
systemctl daemon-reload
systemctl start docker
查看docker状态
systemctl status docker
设置开机启动
systemctl enable docker
查看版本 docker version
[root@centos247 docker]# docker version
Client: Docker Engine - Community
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:05:12 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.9
API version: 1.41 (minimum version 1.12)
Go version: go1.16.8
Git commit: 79ea9d3
Built: Mon Oct 4 16:06:37 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.6
GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc:
Version: 1.1.2
GitCommit: v1.1.2-0-ga916309
docker-init:
Version: 0.19.0
GitCommit: de40ad0
二、离线安装docker-compose
1. 下载docker-compose
官方地址:
https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-linux-x86_64
2.安装
sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose -v
查看版本 docker-compose version
[root@centos247 docker]# docker-compose version
docker-compose version 1.24.1, build 4667896b
docker-py version: 3.7.3
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.1.0j 20 Nov 2018
三. 在线安装
curl -sSL https://get.daocloud.io/docker | sh
四.docker挂载目录更改
4.1 首次安装
vi /etc/docker/daemon.json
# 内容如下:,具体目录试自己情况而定
{
"data-root": "/mnt/run/docker"
}
重启 systemctl restart docker
4.2 已有运行容器
如果已经有容器进行运行了,此时需要创建好具体盘符的目录,使用如下命令进行将容器拷贝到新盘里
cp -R /var/run/docker /mnt/run
再修改目录
vi /etc/docker/daemon.json
# 内容如下:,具体目录试自己情况而定
{
"data-root": "/mnt/run/docker"
}
重启 systemctl restart docker
最后提供一些daemon.json文件内容:
{
"registry-mirrors": ["https://b9pmyelo.mirror.aliyuncs.com"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2",
"data-root": "/home/run/docker"
}
更多推荐
已为社区贡献3条内容
所有评论(0)