一、自我介绍
来自郑州的一位小白运维工作者,希望在51CTO平台和大家一起学习、探索新的技术,一起共同进步。
以后会有更多运维领域基础文章发布,所发布内容都会是当前工组中遇到的一些问题或技术分享或记录。
二、技术分享
1.Docker要求CentOS系统的内核版本高于3.10,在安装之前需要先通过
uname -r
命令查看当前的内核版本是否支持Docker。
2.下载docker的安装文件
https://download.docker.com/linux/static/stable/x86_64/ 将自己需要的版本下载至本地。
3.新建目录用于存放docker
4.将下载至本地的docker离线安装包上传至 /data目录
5.解压安装包
tar -zxvf docker-20.10.9.tgz
6.将解压后的文件移动到/usr/bin目录下
mv docker/* /usr/bin/
7.新建docker启动文件
vi /etc/systemd/system/docker.service
按i插入以下内容,
注意!!! –insecure-registry=192.168.200.128 此处改为你自己服务器ip
[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 --selinux-enabled=false --insecure-registry=192.168.200.128
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
保存并退出
8.给该文件执行权限
chmod +x /etc/systemd/system/docker.service
9.重新加载配置文件并启动docker
systemctl daemon-reload
systemctl start docker
设置开机自启动
systemctl enable docker.service
10.查看docker服务状态 并查看docker版本
systemctl status docker
docker -v
至此,Docker离线安装完成。
三、立一个flag!
下一篇文章,分享近期服务器被恶意入侵的处理办法与解决思路。
服务器租用托管,机房租用托管,主机租用托管,https://www.e1idc.com