欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 财经 > 金融 > 二进制安装docker

二进制安装docker

2024/11/30 2:46:04 来源:https://blog.csdn.net/qq_22321199/article/details/140869284  浏览:    关键词:二进制安装docker

目录

一、准备 Docker CE 二进制包

二、解压.tgz包

三、复制二进制文件到/usr/bin/目录

四、创建用户组

五、配置相关服务配置文件

六、拷贝配置文件到指定目录

七、启动 dockerd 服务进程

八、shell脚本一键安装


一、准备 Docker CE 二进制包

https://download.docker.com/linux/static/stable/x86_64/docker-20.10.24.tgz

二、解压.tgz包

tar -zxvf docker-20.10.24.tgz 
chown root:root docker/*

三、复制二进制文件到/usr/bin/目录

cp -p docker/* /usr/bin/

四、创建用户组

groupadd docker

五、配置相关服务配置文件

有三个配置文件:docker.service 、docker.socket、 containerd.service。

docker.service配置文件:

touch docker.service
vi 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

docker.socket配置文件: 

touch docker.socket
vi docker.socket
[Unit]
Description=Docker Socket for the API
PartOf=docker.service
[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker
[Install]
WantedBy=sockets.target

containerd.service配置文件:

touch containerd.service
vi containerd.service
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target
[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/bin/containerd
Type=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
LimitNOFILE=infinity
# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
OOMScoreAdjust=-999
[Install]
WantedBy=multi-user.target

六、拷贝配置文件到指定目录

sudo cp docker.socket /etc/systemd/system
sudo cp docker.service /etc/systemd/system
sudo cp containerd.service /etc/systemd/system

七、启动 dockerd 服务进程

systemctl enable docker.service
systemctl start docker.servicedocker version

八、shell脚本一键安装

代码地址:https://gitee.com/os-lee/easy_docker

开源不易,麻烦一键三连加star

# 二进制安装(推荐)
sh install-docker.sh install# 卸载
sh install-docker.sh remove# yum安装
sh install-docker.sh yum
[root@localhost easy_docker]# sh install-docker.sh install
创建解压路径
解压软件包到指定目录
docker/
docker/docker-proxy
docker/containerd-shim-runc-v2
docker/ctr
docker/docker
docker/docker-init
docker/runc
docker/dockerd
docker/containerd
docker/containerd-shim
复制docker-compose
复制二进制文件到/usr/bin/目录,创建用户组
配置镜像加速
开机自启动
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /etc/systemd/system/docker.service.
Client:Version:           20.10.24API version:       1.41Go version:        go1.19.7Git commit:        297e128Built:             Tue Apr  4 18:17:06 2023OS/Arch:           linux/amd64Context:           defaultExperimental:      trueServer: Docker Engine - CommunityEngine:Version:          20.10.24API version:      1.41 (minimum version 1.12)Go version:       go1.19.7Git commit:       5d6db84Built:            Tue Apr  4 18:23:02 2023OS/Arch:          linux/amd64Experimental:     falsecontainerd:Version:          v1.6.20GitCommit:        2806fc1057397dbaeefbea0e4e17bddfbd388f38runc:Version:          1.1.5GitCommit:        v1.1.5-0-gf19387a6docker-init:Version:          0.19.0GitCommit:        de40ad0
Docker Compose version v2.18.1
安装成功,欢迎使用【oslee】的docker安装脚本,欢迎下次使用!---> https://gitee.com/os-lee

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com