二进制安装docker

下载二进制包

压到 /usr/local/bin ,我用的版本比较新

https://download.docker.com/linux/static/stable/x86_64/

二进制安装docker

二进制安装docker

创建systemd文件

containerd.service (可选)

cat << 'EOF' > /usr/lib/systemd/system/containerd.service 
[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target

[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/containerd

Type=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5
Having non-zero Limit*s causes performance problems due to accounting overhead
in the kernel. We recommend using cgroups to do container-local accounting.

LimitNPROC=infinity
LimitCORE=infinity
LimitNOFILE=1048576
Comment TasksMax if your systemd version does not supports it.

Only systemd 226 and above support this version.

TasksMax=infinity
OOMScoreAdjust=-999

[Install]
WantedBy=multi-user.target
EOF

docker.service

cat << 'EOF' > /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service containerd.service multi-user.target
Wants=network-online.target
Requires=docker.socket containerd.service

[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/local/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.

Both the old, and new location are accepted by systemd 229 and up, so using the old location
to make them work for either version of systemd.

StartLimitBurst=3

Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.

Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
this option work for either version of systemd.

StartLimitInterval=60s

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

Comment TasksMax if your systemd version does not support it.

Only systemd 226 and above support this option.

TasksMax=infinity

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
OOMScoreAdjust=-500

[Install]
WantedBy=multi-user.target

EOF

docker.socket

cat << 'EOF' > /usr/lib/systemd/system/docker.socket
[Unit]
Description=Docker Socket for the API

[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker

[Install]
WantedBy=sockets.target
EOF

创建docker组

groupadd docker

如果不创建会报错

6月 09 06:30:31 localhost.localdomain systemd[1]: Dependency failed for Docker Application Container Engine.

6月 09 06:30:31 localhost.localdomain systemd[1]: Job docker.service/start failed with result ‘dependency’.

二进制安装docker

启动服务

systemctl daemon-reloadsystemctl start docker

docker 命令补全

安装docker自带包:
source /usr/share/bash-completion/completions/docker
缺少下面的包,TAB会报错
yum install -y bash-completion

Original: https://www.cnblogs.com/outsrkem/p/14864857.html
Author: Outsrkem
Title: 二进制安装docker

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

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

(0)

大家都在看

  • 解决vscode+python不提示numpy函数的问题

    使用vscode编写numpy代码时,对于numpy.array()等方法总是无法提示。查找了很多博客后,大部分都是修改配置和安装多种vscode插件,经过尝试后方法对于我来说无效…

    Linux 2023年6月7日
    0102
  • xshell/bash/zsh 等终端鼠标滚轮乱码问题(转)

    终端上滚动鼠标,有可能不是预期的滚屏,而是出现一些乱码字符 解决方法:输入 reset命令 回车即可 注意: clear或者 ctrl+l是清屏命令,在此情况下无效。 转自: xs…

    Linux 2023年5月28日
    0177
  • 你有想过在同一台服务器中,同时多开几个tomcat吗

    tomcat作为许多java项目的运行的环境,常用来跑java项目。而一台服务器只跑一个tomcat服务又太浪费资源了,so,我们可以在同一台服务器上,同时跑多个tomcat服务进…

    Linux 2023年6月8日
    095
  • TCP/UDP 编程模型

    TCP编程模型 server创建socket套接字 socket套接字–可以理解为文件描述符(file descriptor),UNIX把网络看成文件 /** * @p…

    Linux 2023年6月6日
    0109
  • 内网渗透测试:利用DCOM进行横向渗透——利用ExecuteShellCommand在做远程命令执行

    COM COM即组件对象模型(Component Object Model,COM) ,是基于 Windows 平台的一套组件对象接口标准,由一组构造规范和组件对象库组成。COM是…

    Linux 2023年5月28日
    090
  • 银河麒麟KYLIN安装wireshark进行抓包

    银河麒麟KYLIN安装wireshark进行抓包(前提是网络连通):sudo apt-get updatesudo apt-get install wireshark -y弹出框选…

    Linux 2023年6月13日
    0126
  • #NAME?

    java程序运行时内存设置 -Xms :设置默认内存大小 -Xmx:设置最大内存值 -Xsss 每个线程的堆栈大小,jdk5以后默认时1m,之前是256kb Original: h…

    Linux 2023年6月8日
    084
  • 正则匹配中文

    [\u4e00-\u9fa5]+ 在线正则调试工具 posted @2022-09-14 17:21 自在拉基 阅读(17 ) 评论() 编辑 Original: https://…

    Linux 2023年6月8日
    0102
  • Java动态脚本Groovy获取Bean(奇淫技巧操作)

    前言:请各大网友尊重本人原创知识分享,谨记本人博客: 南国以南i 背景: 在Java代码中当我们需要一个Bean对象,通常会使用spring中@Autowired注解,用来自动装配…

    Linux 2023年6月14日
    0109
  • 操作系统实战45讲笔记- 05 CPU工作模式:程序执行的三种模式

    实模式 实模式又称实地址模式,实,即真实,这个真实分为两个方面,一个方面是运行真实的指令,对指令的动作不作区分,直接执行指令的真实功能,另一方面是发往内存的地址是真实的,对任何地址…

    Linux 2023年6月7日
    088
  • 详解IP地址、子网掩码、网络号、主机号、网络地址、主机地址

    详解IP地址、子网掩码、网络号、主机号、网络地址、主机地址 概念 IP地址:一般是指逻辑ip; 子网掩码:将IP划分为网络号和主机号的IP; 网络号/主机号:子网掩码转成二进制后,…

    Linux 2023年6月6日
    0129
  • 算法小技巧 — 链表

    一、快慢指针 1、核心思想 【核心思想:】 采用双指针完成,一个指针永远比另一个指针稍快一点。 【常见案例:】 找到单链表的中间节点    环形链表 【单链表结构:】 class …

    Linux 2023年6月14日
    080
  • redis五种数据类型及使用场景

    一、Redis简介Redis 是一个开源的使用 C 语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value 数据库。它可以用作数据库、缓存和消息中间件。它支持的数据类…

    Linux 2023年5月28日
    090
  • MySQL — 索引

    索引(Index)是高效获取数据的数据结构,就像书的目录,提高检索数据的效率。 优点:提高数据检索效率,降低数据库的 IO 成本;通过索引列对数据进行排序,降低数据排序的成本,降低…

    Linux 2023年6月8日
    075
  • 【Prometheus+Grafana系列】监控MySQL服务

    前言 前面的一篇文章已经介绍了 docker-compose 搭建 Prometheus + Grafana 服务。当时实现了监控服务器指标数据,是通过 node_exporter…

    Linux 2023年6月7日
    097
  • Redis主从配置总结

    grep ‘^[a-Z]’ /usr/local/redis/conf/redis.conf bind 127.0.0.1 192.168.27.115 protected-mod…

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