首页 > 系统相关 >Centos 离线安装Docker

Centos 离线安装Docker

时间:2022-10-08 16:11:53浏览次数:81  
标签:bin systemd Centos service 离线 systemctl Docker docker

原文出自 Centos7离线安装Docker - 简书 (jianshu.com)

下载Docker并安装

docker包下载地址

#下载docker-20.10.0包
https://download.docker.com/linux/static/stable/x86_64/docker-20.10.0.tgz

#上传到Centos系统/data/目录,如
scp docker-20.10.0.tgz [email protected]:/data/

#进入data目录,解压docker包
cd /data
tar -zxvf docker-20.10.0.tgz

#将解压出来的docker文件内容移动到 /usr/bin/ 目录下
cp docker/* /usr/bin/

#查看docker版本
docker version

#查看docker信息
docker info

配置Docker开机自启动服务

#添加docker.service文件
vi /etc/systemd/system/docker.service
#按i插入模式,复制如下内容:

  

[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

  

#添加文件可执行权限
chmod +x /etc/systemd/system/docker.service

#重新加载配置文件
systemctl daemon-reload

#启动Docker
systemctl start docker

#查看docker启动状态
systemctl status docker

#查看启动容器
docker ps

#设置开机自启动
systemctl enable docker.service

#查看docker开机启动状态 enabled:开启, disabled:关闭
systemctl is-enabled docker.service

 

标签:bin,systemd,Centos,service,离线,systemctl,Docker,docker
From: https://www.cnblogs.com/Way-XC/p/16769244.html

相关文章

  • 【百年会员】大数据从入门到入职|Hadoop|Spark|Flink|FlinkSQL|FlinkCDC|Clickhouse|
    ​关心的问题写在最前面:1.两位数学习正版大数据课程是不是骗子?本课程大部分由《实战大数据(Hadoop+Spark+Flink)》作者本人录制,前期为了做口碑,做销量,两位数可以学习全部课......
  • 【 云原生 | Docker 】- 一文了解Docker
    随着互联网时代的到来,计算机的各项技术都有了巨大提高,推动了虚拟化、容器化技术的产生和发展,以及现在的云原生时代的到来,都极大提高了其资源利用率。DockerDocker本身不......
  • Ubuntu20.04和22.04离线安装PostgreSQL14
    今天安装Postgresql14遇到一个问题,目标服务器只有内网,内网提供标准的apt仓库,但是因为不能连接外网,所以没法添加第三方仓库,这样安装pg14就成了问题.从pg的官网......
  • docker 容器重启失败
    [root@localhostconfig]#dockerrestart2d3039aab086Errorresponsefromdaemon:Cannotrestartcontainer2d3039aab086:driverfailedprogrammingexternalconn......
  • mac通过docker一键部署MySQL8
    目录mac通过docker一键部署MySQL8一、前言二、系统配置三、安装步骤Dockerhub查看镜像地址1、一键安装1.1、克隆脚本1.2、安装程序1.2.1、程序安装详情1.3、初始化用户1.3.......
  • Centos7部署pptp
    方法一查看参考文章即可。方法二安装pptp和pppyuminstallppppptpd-y如果安装不了,换yum源下载阿里云或者网易镜像cd/etc/yum.repos.dmvCentOS-Base.repoCe......
  • CentOS 7.9 安装 rocketmq-4.9.2
    一、CentOS7.9安装rocketmq-4.9.2地址:https://rocketmq.apache.orghttps://github.com/apache/rocketmqhttps://archive.apache.org/dist/rocketmq/4.9.2/rocketmq......
  • docker搭建yapi接口文档系统、Idea中上传接口、在线调用
    一、前言在我们后端开发中,必不可少的是接口的交接,有很多种方式,常见的就是swagger,不过这个侵入性太强了。还有就是接口文档的框架,比如今天小编带大家一起搭建的yapi,在公司......
  • Centos7_docker509错误
    CentOS7Dockerx509:certificatesignedbyunknownauthority解决方案registry-1.docker.io/v2/1.echo-n|openssls_client-showcerts-connectregistry-1.doc......
  • docker 安装 elasticsearch
    1.拉取镜像:sudodockerpullelasticsearch:7.12.02.创建docker容器挂载目录:sudomkdir-pv/opt/elasticsearch/configsudomkdir-pv/opt/elasticsearch/datasu......