当前位置: 首页 > news >正文

centos7下docker的安装

背景

总结下docker的一些知识

docker安装(有网络版)

参考文章我以前试过这个帖子,建议安装高版本的docker,(20以上的,不然可能会有一些问题)

## 1、安装依赖
[root@iZo7e61fz42ik0Z ~]#yum install -y yum-utils device-mapper-persistent-data lvm2
## 2、添加docker软件源
[root@iZo7e61fz42ik0Z ~]#yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
## 3、只保留稳定版本
[root@iZo7e61fz42ik0Z ~]#yum-config-manager --disable docker-ce-edge
[root@iZo7e61fz42ik0Z ~]#yum-config-manager --disable docker-ce-test
## 4、更新包索引
[root@iZo7e61fz42ik0Z ~]#yum makecache fast
## 5、更新yum包索引
[root@iZo7e61fz42ik0Z ~]#yum list docker-ce --showduplicates|sort -r
Loading mirror speeds from cached hostfile
Loaded plugins: fastestmirror
Installed Packages
docker-ce.x86_64            3:18.09.0-3.el7                    docker-ce-stable
docker-ce.x86_64            18.06.1.ce-3.el7                   docker-ce-stable
docker-ce.x86_64            18.06.1.ce-3.el7                   @docker-ce-stable
docker-ce.x86_64            18.06.0.ce-3.el7                   docker-ce-stable
docker-ce.x86_64            18.03.1.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            18.03.0.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.12.1.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.12.0.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.09.1.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.09.0.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.06.2.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.06.1.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.06.0.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.03.3.ce-1.el7                   docker-ce-stable
docker-ce.x86_64            17.03.2.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.03.1.ce-1.el7.centos            docker-ce-stable
docker-ce.x86_64            17.03.0.ce-1.el7.centos            docker-ce-stable
Available Packages
# 安装指定版本
[root@iZo7e61fz42ik0Z ~]#yum -y install docker-ce-18.06.1.ce

Docker安装完毕,启动Docker服务查看一下版本

# 启动docker
[root@iZo7e61fz42ik0Z ~]#systemctl start docker
# 开机自启
[root@iZo7e61fz42ik0Z ~]#systemctl enable docker
# 查看版本
[root@iZo7e61fz42ik0Z ~]# docker version
Client:Version:           18.06.1-ceAPI version:       1.38Go version:        go1.10.3Git commit:        e68fc7aBuilt:             Tue Aug 21 17:23:03 2018OS/Arch:           linux/amd64Experimental:      falseServer:Engine:Version:          18.06.1-ceAPI version:      1.38 (minimum version 1.12)Go version:       go1.10.3Git commit:       e68fc7aBuilt:            Tue Aug 21 17:25:29 2018OS/Arch:          linux/amd64Experimental:     false

docker安装(无网络版)

  • 提前下载docker,下载docker的安装文件:https://download.docker.com/linux/static/stable/x86_64/
  • 开始安装
docker  安装,这里我下载的19.03.9,后续就出现了一些端口安全的问题
#   解压docker 安装包
tar -zxvf docker-19.03.9.tgz
#  解压文件移动到到 /usr/bin
mv docker/* /usr/bin/ 
# 配置docker.service 文件
cd /etc/systemd/system/
# 把离线部署里的docker.service文件传到这个目录
可以使用sftp,或者rz命令   
# 赋予执行权限
chmod +x /etc/systemd/system/docker.service     
# 重新加载配置文件
systemctl daemon-reload
# 开机自启
systemctl enable docker.service                                          
# 启动docker
systemctl start docker   
#查看docker版本docker -v        
  • 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 -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
ExecReload=/bin/kill -s HUP
# 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
http://www.lryc.cn/news/303273.html

相关文章:

  • Excel SUMPRODUCT函数用法(乘积求和,分组排序)
  • C#上位机与三菱PLC的通信08---开发自己的通讯库(A-1E版)
  • ABAQUS应用04——集中质量的添加方法
  • [嵌入式系统-24]:RT-Thread -11- 内核组件编程接口 - 网络组件 - TCP/UDP Socket编程
  • 【ansible】认识ansible,了解常用的模块
  • 【LeetCode】升级打怪之路 Day 01:二分法
  • 单片机stm32智能鱼缸
  • 面试经典150题——生命游戏
  • 【C++】C++11下线程库
  • 面试经典150题——矩阵置零
  • 多端开发围炉夜话
  • 分治算法总结(Java)
  • 【云原生系列之kubernetes】--Ingress使用
  • 练习:鼠标类设计之2_类和接口
  • 【程序员英语】【美语从头学】初级篇(入门)(笔记)Lesson 15 At the Department Store 在百货商店
  • linux 安装、删除 JTAG驱动
  • CSS的伪类选择器:nth-child()
  • python celery使用队列
  • 四非保研之旅
  • 基于Java+SpringBoot的旅游路线规划系统(源码+论文)
  • AI与测试自动化:未来已来
  • 深度学习基础之《TensorFlow框架(6)—张量》
  • 第三百六十六回
  • Fiddler工具 — 18.Fiddler抓包HTTPS请求(一)
  • 多租户数据库的缓冲区共享和预分配方案设计
  • C++:C++入门基础
  • 利用System.Web.HttpRuntime.Cache制作缓存工具类
  • 266.【华为OD机试真题】抢7游戏(深度优先搜索DFS-JavaPythonC++JS实现)
  • 工具分享:在线键盘测试工具
  • Arcmap excel转shp