docker 安装、升级、修改数据目录
1、查看系统要求
Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看CentOS的内核版本。
uname -a
2、删除旧版本
yum remove docker docker-common docker-selinux docker-engine
3、安装需要的软件包
yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
4、设置Docker yum源
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
5、查看所有仓库中所有docker版本
可以查看所有仓库中所有docker版本,并选择特定的版本安装。
yum list docker-ce --showduplicates | sort -r
6、安装docker
sudo yum install docker-ce
由于repo中默认只开启stable仓库,故这里安装的是最新稳18.03.0.ce-1.el7.centos。
如果要安装特定版本:
sudo yum install docker-ce-18.06.1.ce
7、启动
设置为开机启动
systemctl enable docker
启动
systemctl start docker
查看启动状态
systemctl status docker
如果出现异常
$ systemctl start docker
A dependency job for docker.service failed. See 'journalctl -xe' for details.
查看报错信息
Mar 03 11:19:47 master1 systemd[1]: Starting containerd container runtime...
-- Subject: Unit containerd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit containerd.service has begun starting up.
Mar 03 11:19:47 master1 systemd[104332]: Failed at step LIMITS spawning /sbin/modprobe: Operation not permitted
-- Subject: Process /sbin/modprobe could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The process /sbin/modprobe could not be executed and failed.
--
-- The error number returned by this process is 1.
Mar 03 11:19:47 master1 systemd[104335]: Failed at step LIMITS spawning /usr/bin/containerd: Operation not permitted
-- Subject: Process /usr/bin/containerd could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The process /usr/bin/containerd could not be executed and failed.
解决方案:
查看open files的值,修改/usr/lib/systemd/system/docker.service和/usr/lib/systemd/system/containerd.service(如下图),启动即可
$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 23056
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 654350
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 23056
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
$ vim /usr/lib/systemd/system/docker.service
...
# 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=654349 # 注意这里
LimitNPROC=23057
LimitCORE=infinity
# Comment TasksMax if your systemd version does not supports it.
...
$ vim /usr/lib/systemd/system/containerd.service
...
# 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=654349 # 注意这里
LimitNPROC=23057
LimitCORE=infinity
# Comment TasksMax if your systemd version does not support it.
...
查看版本
docker version
8、修改数据目录
查看docker当前信息
$ docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
Containers: 40
Running: 15
Paused: 0
Stopped: 25
Images: 91
Server Version: 20.10.17
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc version: v1.1.2-0-ga916309f
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-1160.71.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 15.5GiB
Name: master1
ID: 3WQC:QCTB:I5D4:2ZWL:VBSH:6GWQ:4W2G:BTK2:XSEY:PDXG:BQAI:ZB6D
Docker Root Dir: /data/docker # 这里是数据目录的位置,我因为已经更改过,原位置为/var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://x6u7jv2l.mirror.aliyuncs.com/
Live Restore Enabled: false
9、停止docker服务
$ systemctl stop docker
10、修改docker服务启动文件
vi /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --graph=/data/docker
11、复制原有数据,若无数据,可跳过此步骤
$ cp -rf /var/lib/docker/* /data/docker/
12、重新加载配置文件并启动
$ systemctl daemon-reload
$ systemctl start docker
最后执行步骤8,查看是否已启动
docker 安装、升级、修改数据目录的更多相关文章
- docker安装升级linux内核(2.6.32->3.10.81)
.内核升级环境准备 #查看已经安装的和未安装的软件包组,来判断我们是否安装了相应的开发环境和开发库: yum grouplist #一般是安装这两个软件包组,这样做会确定你拥有编译时所需的一切工具 y ...
- docker安装升级linux内核(2.6.32->3.12.17)
1.内核升级环境准备 #查看已经安装的和未安装的软件包组,来判断我们是否安装了相应的开发环境和开发库:yum grouplist#一般是安装这两个软件包组,这样做会确定你拥有编译时所需的一切工具yum ...
- docker安装并修改Nginx镜像
1.安装nginx镜像,命令:docker pull nginx 2.创建nginx容器,并启动,命令:docker run --name webserver -d -p 192.168.51.227 ...
- centos6.5linux安装docker之升级内核
一.运行docker Linux内核版本需要在3.8以上,针对centos6.5 内核为2.6的系统需要先升级内核.不然会特别卡 在yum的ELRepo源中,有mainline(4.5).long-t ...
- CentOS 修改源为163和指定epel源和docker安装
首先备份/etc/yum.repos.d/CentOS-Base.repo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-B ...
- docker+nginx 安装部署修改资源目录配置文件和容器端口信息
查看docker镜像 可以先查看docker下是否存在nginx镜像,使用如下这些命令查看: docker images: 列出所有镜像. docker images nginx: 列出所有nginx ...
- 【云计算】ubuntu下docker安装配置指南
Docker Engine安装配置 以下描述仅Docker在Ubuntu Precise 12.04 (LTS).Ubuntu Trusty 14.04 (LTS).Ubuntu Wily 15.10 ...
- 使用docker安装部署Spark集群来训练CNN(含Python实例)
使用docker安装部署Spark集群来训练CNN(含Python实例) http://blog.csdn.net/cyh_24/article/details/49683221 实验室有4台神服务器 ...
- Docker学习实践 - Docker安装MySql数据库
Docker安装MySQL数据库 1.Ubuntu安装MySQL安装 (1)安装编译源码需要的包 sudo apt-get install make cmake gcc g++ bison libnc ...
- 使用Docker安装Jenkins
Jenkins Jenkins是一个开源软件项目,是基于Java开发的一种持续集成工具,用于监控持续重复的工作,旨在提供一个开放易用的软件平台,使软件的持续集成变成可能. 环境准备 腾讯云 硬件配置: ...
随机推荐
- 无需学习Python,一个公式搞定领导想看的大屏
摘要:本文由葡萄城技术团队于博客园原创并首发.转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具.解决方案和服务,赋能开发者. 不要让"做不了"成为数字化转型的障碍 随着 ...
- Django基本数据库操作
Django基本数据库操作 @ 目录 Django基本数据库操作 内容一:基本数据库配置 内容二:ORM基本操作 内容一:基本数据库配置 Django是一个流行的Python Web框架,它可以 ...
- quarkus实战之一:准备工作
欢迎访问我的GitHub 这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos 关于<quarkus实战>系列 <q ...
- OlllyDbg调试器和IDA调试器
OllyDbg调试器 OllyDbg称为Ring3级的首选工具.可以识别数千个被和Windows频繁使用的函数,并能将其注释出来.它会自动分析函数过程.循环语句等 OllyDbg主界面 快捷键 Add ...
- html5 2.0学习
列表定义:是一种特别的对象集合.集合:集中在一起合二为一(聚集). 聚集:多个列(信息资源)排在一起.信息资源:一堆数据,可能是字符,可能是图片. 列表分类:有序列表 无序列表 (自)定义列表 有 ...
- Ubuntu20.04 下编译和运行 FreeSWITCH的问题汇总
1. Ubuntu20.04 下编译和运行 FreeSWITCH的问题汇总 1.1. 环境 Ubuntu20.04.2 LTS (Linux 5.4.0-152-generic x86_64 GNU/ ...
- CAJViewer卡的解决办法
在做毕业设计时,使用了CAJViewer7.2版本的阅读器,使用起来非常卡,翻页总是不流畅,体验感极差. 最后实在受不了了,去百度了一下,在贴吧中看到了疑似解决方案,尝试了一下,真的不卡了.所以特此写 ...
- centos7关闭防火墙后只有22端口可以telnet的解决方法
1.问题描述 防火墙已经关闭 22端口可以telnet 其他端口无法telnet 2.解决方法 注意:下列命令要用root账号/权限执行 2.1.开启防火墙 systemctl start firew ...
- 【JMeter】使用BeanShell写入内容到文件
使用BeanShell写入内容到文件 目录 使用BeanShell写入内容到文件 一.前言 二.提取 三.写入 一.前言 在我们日常工作中,可能会遇到需要将请求返回的数据写入到文件中.在我们使用J ...
- HiAI Foundation助力端侧音视频AI能力,高性能低功耗释放云侧成本
过去三年是端侧AI高速发展的几年,华为在2020年预言了端侧AI的发展潮流,2021年通过提供端云协同的方式使我们的HiAI Foundation应用性更进一个台阶,2022年提供视频超分端到端的解决 ...