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)

大家都在看

  • linux正则表达式初探

    为什么要学习正则表达式? 简单而言,仅仅用通配符无法满足处理字符的需求,这时候就是正则表达式大展身手的机会。相较而言,正则表达式比通配符更灵活,也更强大。 我们在网站注册用户的时候…

    Linux 2023年6月7日
    086
  • acl/客户端缓存/多级缓存

    redis6安装注意点 我们课程里忽略了,就不去安装了,仅仅只提供安装文档,redis6的安装其实和redis5安装差不多,只是需要注意gcc的版本需要提高,不然编译会出错。参考慕…

    Linux 2023年5月28日
    099
  • WPF 切换主题使用 luna 复古版本

    本文告诉大家如何在 WPF 里面使用 luna 等复古主题 今天在 lsj 说他准备优化 WPF 的程序集时,准备删除 luna 等程序集时,找到了一段有趣的注释,发现在 WPF …

    Linux 2023年6月6日
    085
  • 为Windows Service 2019 使用 Docker

    引言最近收到领导通知,甲方需要将原来的服务器迁移到新的服务器。原来的服务器上安装了很多的服务,每次重启之后总是有很多的问题需要人工大量的进行干预。这次迁移的还是Windows服务器…

    Linux 2023年6月14日
    0119
  • 学生管理系统(初级)

    #include #include #include #define Size sizeof(struct Student) struct Student *p = NULL; t…

    Linux 2023年6月7日
    0107
  • 大数据之Hadoop的HDFS存储优化—异构存储(冷热数据分离)

    异构存储主要解决,不同的数据,储存在不同类型的硬盘中,达到最佳性能的问题 1)存储类型 RAM_DISK:内存镜像文件系统 SSD:SSD固态硬盘 DISK:普通磁盘,在HDFS中…

    Linux 2023年6月8日
    093
  • 高等代数:3 线性方程组的解集的结构

    3 线性方程组的解集的结构 1、定义1:数域K上所有n元有序数组组成的集合(K^{n}),连同定义在它上面的加法运算和数量乘法运算,以及满足的8条运算法则一起,称为数域K上的一个 …

    Linux 2023年6月8日
    099
  • LAMP 架构介绍及环境搭建

    1、LAMP 架构介绍及环境搭建 1.LAMP分别代表什么? L代表服务器操作系统使用Linux A代表网站服务使用的是Apache软件基金会中的httpd软件 M代表网站后台使用…

    Linux 2023年6月7日
    0109
  • MapReduce入门实例——WordCount

    摘要:MapReduce的IDEA配置及WordCount案例 Maven项目配置 创建一个空的Maven项目 打开根目录下的 pom.xml文件,参考配置: UTF-8 3.2….

    Linux 2023年6月8日
    0100
  • Spring Security登录的流程

    Spring Security登录的流程 1、UsernamePasswordAuthenticationFilter这过滤器开始 attemptAuthentication方法 …

    Linux 2023年6月7日
    0202
  • 这几天的杂学

    404. 抱歉,您访问的资源不存在。 可能是网址有误,或者对应的内容被删除,或者处于私有状态。 代码改变世界,联系邮箱 contact@cnblogs.com 园子的商业化努力-困…

    Linux 2023年6月7日
    0101
  • haproxy-详解

    四层: LVS (Linux Virtual Server)HAProxy (High Availability Proxy)Nginx (1.9以上) 七层: HAProxyNg…

    Linux 2023年6月14日
    0101
  • jmeter之数据库连接JDBC安装与使用

    jmeter中如果要用sql语句查询数据库,就需要用到JDBC请求和JDBC Connection Configuration了。 首先来了解下,JDBC是什么?英文全称为Java…

    Linux 2023年6月8日
    0121
  • sqlserver查询(子查询,全连接,等值连接,自然连接,左右连,交集,并集,差集)

    –部门表 create table dept( deptno int primary key,–部门编号 dname nvarchar(30),–部门名 loc nvarch…

    Linux 2023年6月7日
    0115
  • RestFul风格

    概念:Restful就是一个资源定位及资源操作的风格。不是标准也不是协议,只是一种风格。基于这个风格 设计的软件可以更简洁,更有层次,更易于实现缓存等机制。 功能资源:互联网所有的…

    Linux 2023年6月14日
    096
  • Docker如何镜像加速

    原文链接:https://www.zhoubotong.site/post/69.html在使用Docker 下载镜像时,如果不配置镜像加速,下载镜像会比较慢,因为国内从 Dock…

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