中标麒麟离线安装Docker
参照官方Install static binaries的过程
安装Docker
- 在https://download.docker.com/linux/static/stable/下载对应版本的docker程序文件
- 解压文件:
tar xzvf /path/to/<FILE>.tar.gz
- 把解压出来的文件移动到
/usr/bin
:sudo cp docker/* /usr/bin/
- 把docker注册为服务,创建文件
/usr/lib/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 --selinux-enabled=false --insecure-registry=127.0.0.1
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
- 设置镜像源,创建配置文件:
/etc/docker/daemon.json
,
此处使用163的源,可以换其他源
{
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}
- 按顺序执行以下命令:
命令 | 说明 |
---|---|
chmod +x /usr/lib/systemd/system/docker.service | 对docker.service授予执行权限 |
systemctl daemon-reload | 重载服务配置 |
systemctl start docker | 运行docker |
systemctl status docker | 运行docker |
systemctl enable docker | 使docker自动启动 |
使用其他用户执行docker命令
sudo groupadd docker #添加docker用户组
sudo gpasswd -a $USER docker #将登陆用户加入到docker用户组中
newgrp docker #更新用户组
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架