在CentOS6中安装Docker

  • 背景
  • 步骤
    • 方法一(安装rpm包)
    • 方法二(下载预编译文件)
  • 问题
    • 问题一
    • 问题二
    • 问题三
    • 问题四

背景

由于公司既有多台CentOS6服务器,并且需要在上面继续部署一些其他内部测试服务,为了方便直接安装上Docker。

  • Docker官方已不再支持CentOS6
  • 如需部署,请部署测试环境,部署线上会有一堆问题

步骤

由于Docker官方已不再支持CentOS6,因此做特定处理

方法一(安装rpm包)

下载官方提供的1.7.1-2版本

yum install -y https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm

此方法虽是官方,但极不稳定,会带来内存泄露与containe和image丢失的问题

方法二(下载预编译文件)

到这 下载地址 获取需要版本(当下载19.03.0及之后的版本,可以将rootless扩展包也下载,尽量不要安装17版本的,会带来内存泄露与containe和image丢失的问题)
根据以下步骤完成替换:

1、Download the static binary archive. Go to https://download.docker.com/linux/static/stable/ (or change stable to nightly or test), choose your hardware platform, and download the .tgz file relating to the version of Docker Engine - Community you want to install.2、Extract the archive using the tar utility. The dockerd and docker binaries are extracted.$ tar xvf /path/to/docker-18.09.9.tgz
3、Optional: Move the binaries to a directory on your executable path, such as /usr/bin/. If you skip this step, you must provide the path to the executable when you invoke docker or dockerd commands.$ sudo cp docker/* /usr/bin/
4、Start the Docker daemon:$ sudo dockerd &If you need to start the daemon with additional options, modify the above command accordingly or create and edit the file /etc/docker/daemon.json to add the custom configuration options.5、Verify that Docker is installed correctly by running the hello-world image.$ sudo docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.

问题

问题一

[root@dev141 src]# INFO[0000] libcontainerd: new containerd process, pid: 29287
WARN[0000] containerd: low RLIMIT_NOFILE changing to max  current=1024 max=4096
ERRO[0001] devmapper: Udev sync is not supported. This will lead to data loss and unexpected behavior. Install a dynamic binary to use devicemapper or select a different storage driver.      For more information, see https://docs.docker.com/engine/reference/commandline/daemon/#daemon-storage-driver-option
ERRO[0001] [graphdriver] prior storage driver "devicemapper" failed: driver not supported
FATA[0001] Error starting daemon: error initializing graphdriver: driver not supported

由于Docker并不支持Udev同步,Udev在创建和清理期间 和之间会发生竞争导致错误和失败。(有关这些失败的信息,请参阅 docker#4036)

方法一(清除运行文件,当竞争时还是会出错)

#删掉 /var/lib/docker  文件夹
sudo rm -rf  /var/lib/docker
#重新启动,问题解决!
sudo dockerd &

方法二(添加启动检测)

# 添加检测,当不支持时自动处理
sudo dockerd --storage-opt dm.override_udev_sync_check=true &

问题二

Devices cgroup isn't mounted

这是cgroup驱动没有加载。

方法:

#安装cgroup
sudo yum install libcgroup#启动cgroup
sudo service cgconfig start

问题三

Failed to Setup IP tables: Unable to enable SKIP DNAT rule:  (iptables failed: iptables --wait -t nat -I DOCKER -i br-d10914bf273f -j RETURN: iptables: No chain/target/match by that name.

导致这错误的原因是:
由于iptables重启过,导致docker对DNAT(目的地址转换)无法跳过或找不到而出错

方法:

service docker restart
# 或者(以下省略了启动的参数,可继续使用自己的启动参数)
sudo dockerd &

问题四

每次卸载加载Docker容器都会发现对外端口无法访问。

这是由于Docker对CentOS6的iptables的支持有限,需要将容器设为restart:always,重启Docker自动配置iptables。

在CentOS6中安装Docker(新服务器不推荐)相关推荐

  1. centos6.5安装docker

    centos6.5 安装docker 防伪码:吃的苦中苦,方为人上人! 前言:在当今的主流社会中,docker和openstatick是一大主流方向,下面为大家讲解理论知识和实际操作现实中的docke ...

  2. CentOS 8中安装Docker出现和Podman冲突

    感谢这位博主的文章: CentOS 8中安装Docker出现和Podman冲突_ywyngq的博客-CSDN博客https://blog.csdn.net/ywyngq/article/details ...

  3. centos 7 中安装 docker和创建 tomcat容器并部署web应用

    在 CentOS 7 中安装 Docker 和创建 Tomcat 容器并部署Web应用 一般部署Web应用都需要安装数据库,比如 MySQL 和 Redis,MySQL 和 Redis 属于多个Web ...

  4. 在centos6中安装2.4版本的HTTPd

    由于httpd2.4版本是基于APR -1.4版本以上的,但centos6中的apr版本是1.3的,所以要想在centos6中安装httpd2.4版本,要先编译安装apr-1.4以上的版本. cent ...

  5. abp 打包部署到ubuntu_如何在Ubuntu中安装Docker和运行 Docker容器

    Docker是一种开源且流行的操作系统级虚拟化(俗称"容器化")技术,主要在Linux和Windows上运行. Docker使用容器可以更轻松地创建,部署和运行应用程序. 使用容器 ...

  6. Docker - 在CentOS 7中安装Docker

    在CentOS 7中安装Docker 1-确认系统信息 # cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) # uname - ...

  7. Ubuntu 16.04 中 安装 Docker

    1. 在Ubuntu中安装Docker 挨个复制如下命令即可安装成功 更新ubuntu的apt源索引 sudo apt-get update 安装包允许apt通过HTTPS使用仓库 sudo apt- ...

  8. 在deepin中安装docker

    本文转载:https://www.cnblogs.com/wh4am1/p/10263272.html 用往常方法安装 一般在Linux中安装docker的时候都会使用这条命令 wget -qO- h ...

  9. linux添加一块硬盘分区,centos6中添加一块新的硬盘并分区的方法介绍

    centos6中是如何添加硬盘和分区的呢?接下来的文章中小编将会带来详细的操作方法介绍,想知道的朋友可以阅读本文了解一下. 具体要求如下: 1.添加一块新的硬盘,大小1G 2.分五个区,每个大小100 ...

最新文章

  1. Spring Cloud Config-Git后端
  2. Spring Boot2.x-13前后端分离的跨域问题解决方法之Nginx
  3. 阿里面试题Linux curl命令详解
  4. 深度学习:Neural Network Layers Understanding
  5. 统计dataframe中所有列的null数量与填充null注意事项
  6. 华为5G英国首秀,BBC主持人震惊了!到底网速有多快?
  7. java内部类选择题_java内部类使用总结
  8. gcc生成的汇编和keil生成的汇编_Linux编译工具:gcc入门
  9. java 访问器_网络之美 JavaScript中Get和Set访问器的实现代码
  10. Linux x86-64 IOMMU详解(一)——IOMMU简介
  11. 计算机二级(C语言)备考
  12. 元胞自动机python代码_Python实现元胞自动机(康威生命游戏)
  13. 十款真正的编程游戏软件
  14. 推荐10个高效好用的办公软件,极大提升效率
  15. iOS新机 iPhoneXS max和iPhoneXR适配
  16. tarjan算法中比较dfn 还是low
  17. 鸿蒙智慧屏和pro有什么区别,华为智慧屏V55i和荣耀智慧屏PRO区别对比
  18. 小米路由作二级路由,挂在上级路由之下,samba能被上级访问
  19. 2013年度对话《3S 新闻周刊》
  20. 联想st510开卡软件_无力吐槽的一单联想ST510固态硬盘数据恢复

热门文章

  1. 《python基础教程》笔记之 列表
  2. Linux memcache操作命令
  3. Graphics 单元中的类
  4. 解决thrift: ···No such file or directory问题
  5. PhpMyAdmin 配置文件现在需要一个短语密码的解决方法
  6. CentOS网络设置 couldn‘t resolve host ‘mirrorlist.centos.org问题解决
  7. Ubuntu/Mac彻底解决手机ADB识别问题
  8. Markdown引用图片,且不使用网上链接的解决方法
  9. 【报告分享】人工智能2020:落地挑战与应对.pdf(附下载链接)
  10. 深度学习福利入门到精通第四讲——GoogleNet模型