CentOS7.4安装docker

1、安装环境

此处在Centos7进行安装,可以使用以下命令查看CentOS版本

lsb_release -a

在 CentOS 7安装docker要求系统为64位、系统内核版本为 3.10 以上,可以使用以下命令查看

uname -r

2、用yum源安装

2.1 查看是否已安装docker列表

yum list installed | grep docker

2.2 安装docker

yum -y install docker

-y表示不询问安装,直到安装成功,安装完后再次查看安装列表

2.3 启动docker

systemctl start docker

2.4 查看docker服务状态

systemctl status docker

以上说明docker安装成功

3、离线安装模式

3.1 安装包官方地址https://download.docker.com/linux/static/stable/x86_64/

可以先下载到本地,然后通过ftp工具上传到服务器上,或者在服务器上使用命令下载

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

3.2 解压

tar -zxvf docker-18.06.3-ce.tgz

3.3 将解压出来的docker文件复制到 /usr/bin/ 目录下

cp docker/* /usr/bin/

3.4 在/etc/systemd/system/目录下新增docker.service文件,内容如下,这样可以将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

此处的–insecure-registry=127.0.0.1(此处改成你私服ip)设置是针对有搭建了自己私服Harbor时允许docker进行不安全的访问,否则访问将会被拒绝。

3.5 启动docker

给docker.service文件添加执行权限

chmod +x /etc/systemd/system/docker.service

重新加载配置文件(每次有修改docker.service文件时都要重新加载下)

systemctl daemon-reload

启动

systemctl start docker

设置开机启动

systemctl enable docker.service

查看docker服务状态

systemctl status docker

本文转载自:https://www.cnblogs.com/kingsonfu/p/11576797.html

Original: https://www.cnblogs.com/JimmyThomas/p/15939650.html
Author: JimmyThomas
Title: CentOS7.4安装docker

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/524060/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • Centos下使用containerd管理容器:5分钟从docker转型到containerd

    一.系统环境 二.前言 三.containerd 四.部署containerd 4.1 安装containerd 4.2 containerd配置文件 4.3 配置containe…

    Linux 2023年6月7日
    0154
  • 测试代理的墙是否是通的

    curl -v -x 代理ip:端口 目的ip:端口通过代理访问对方wget “http://目的IP:端口” -e use_proxy=yes -e ht…

    Linux 2023年6月14日
    0101
  • 一篇文章带你全面读懂Android Backup

    前言 手机等智能设备是现代生活中的重要角色,我们会在这些智能设备上做登录账户,设置偏好,拍摄照片,保存联系人等日常操作。这些数据耗费了我们很多时间和精力,对我们而言极为重要。 如果…

    Linux 2023年6月13日
    0128
  • 使用JMeter和Zabbix进行压力测试

    Zabbix JMeter 目标 reference Zabbix Zabbix区分探针端、服务端、数据库、WEB前端等多个组件,如果你是在企业内使用,尽量使用运维同学搭建好的环境…

    Linux 2023年6月6日
    086
  • CentOS 文件管理

    一、目录管理 1.1、目录结构 1.2、切换目录 1.3、查看目录 1.4、创建目录 1.5、复制目录 1.6、剪切目录 1.7、删除目录 二、文件管理 2.1、查看文件 2.2、…

    Linux 2023年5月27日
    0156
  • 如何使用 systemctl 管理服务

    systemd是一个服务管理器,目前已经成为Linux发行版的新标准。它使管理服务器变得更加容易。了解并利用组成systemd的工具将有助于我们更好地理解它提供的便利性。 syst…

    Linux 2023年6月13日
    076
  • CentOS7 源码安装Nginx及Nginx基本管理设置

    CentOS7 安装 参考文档 CentOS7最小安装后初始化安装工具 1:yum install net-tools 参考文档 2:源码安装wget 参考文档 或者执行 yum …

    Linux 2023年5月27日
    0115
  • @Aspect

    AOP是指在程序运行期间动态地将某段代码切入到指定位置并运行的编程方式。 AOP详解可参考:https://blog.csdn.net/javazejian/article/det…

    Linux 2023年6月8日
    099
  • postgres 错误duplicate key value violates unique constraint 解决方案

    把当前最大的id做为当前的id自增起始数运行下面的SQL就行了 SELECT setval(‘tablename_id_seq’, (SELECT MAX(id) FROM tab…

    Linux 2023年6月14日
    098
  • Nginx 平滑升级(不需要关闭Nginx升级)

    Nginx 平滑升级 对Nginx的版本进行更新,或者要增添新的模块,最简单的方法就是停止当前的Nginx服务,重新编译安装nginx,然后开启新的Nginx服务。但是这样会导致在…

    Linux 2023年6月13日
    085
  • Android 图片设置圆角

    Android 开发中,经常需要对图片进行二次处理,比如添加圆角效果 或 显示圆形图片; 通过第三方框架 Glide 设置圆角效果; 写法1: RequestOptions opt…

    Linux 2023年6月13日
    077
  • Linux pssh安装与使用

    说明:我这是没有在密钥认证的情况下操作 1、安装pssh [root@libin ansible]# yum install -y pssh [root@libin ansible…

    Linux 2023年6月13日
    086
  • 当保存参数使用结构体时必备的开发技巧方式

    1、前言 想必做嵌入式产品开发都遇到过设备需要保存参数,常用的方式就是按照结构体的方式管理参数,保存时将整个结构体数据保存在 Flash 中,方便下次读取。 1.1、目的 本文时分…

    Linux 2023年6月7日
    0106
  • 白话linux操作系统原理

    虽然计算机相关专业,操作系统和计算机组成原理是必修课。但是大学时和真正从事相关专业工作之后,对于知识的认知自然会发生变化。还很有可能,一辈子呆在学校的老师们只是照本宣科,自己的理解…

    Linux 2023年6月14日
    080
  • 【原创】Linux虚拟化KVM-Qemu分析(七)之timer虚拟化

    背景 Read the fucking source code! –By 鲁迅 A picture is worth a thousand words. –…

    Linux 2023年6月8日
    099
  • Redis安装及HA(High Availability)配置

    Redis是一种内存数据库,以KEY-VALUE(即键值对)的形式存储数据。这篇文章主要介绍的是Redis安装及配置,所以不对Redis本身作详细介绍了。 下 载: 解 压: 以r…

    Linux 2023年5月28日
    072
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球