docker 在centos6 和centos7上的区别
这些天研究了下docker,在centos6.6上装了个docker1.7.1,在centos7.6上装了个docker18.09.0
两者还是有区别的。
1.配置docker国内镜像加速
Docker的1.7.1版本Docker配置文件在/etc/sysconfig/docker下,1.8或者1.10等更高版本在/etc/docker/daemon.json
docker 1.7配置如下
# /etc/sysconfig/docker
#
# Other arguments to pass to the docker daemon process
# These will be parsed by the sysv initscript and appended
# to the arguments list passed to docker -d other_args="--registry-mirror=https://yvaq2qqy.mirror.aliyuncs.com" #OPTIONS='--registry-mirror=https://yvaq2qqy.mirror.aliyuncs.com' DOCKER_CERT_PATH=/etc/docker # Resolves: rhbz#1176302 (docker issue #407)
DOCKER_NOWARN_KERNEL_VERSION=1 # Location used for temporary files, such as those created by
# # docker load and build operations. Default is /var/lib/docker/tmp
# # Can be overriden by setting the following environment variable.
# # DOCKER_TMPDIR=/var/tmp
之后service docker restart。并查看进程,发现已经改掉。
[root@localhost docker]# ps -ef|grep docker
root 2746 1 0 06:25 pts/0 00:00:00 /usr/bin/docker -d --registry-mirror=https://yvaq2qqy.mirror.aliyuncs.com
root 2790 1665 0 06:25 pts/0 00:00:00 grep docker
更高docker版本配置
![]() |
sudo mkdir -p /etc/docker |
之后用docker info验证
[root@localhost docker]# docker info
Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 2
Server Version: 18.09.0
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: c4446665cb9c30056f4998ed953e6d4ff22c7c39
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-957.1.3.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 991.2MiB
Name: localhost.localdomain
ID: H3P2:25SP:CIQM:G5V5:VWFZ:2ENN:YGO5:JDAA:NSVJ:BEPY:EPZK:J4QE
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors: #这个配置已生效
https://yvaq2qqy.mirror.aliyuncs.com/
Live Restore Enabled: false
Product License: Community Engine
2.CentOS7中关闭firewall,并使用iptables管理防火墙
下载完镜像后,启动时候,竟然出现如下错误。
[root@localhost ~]# docker run -d -P training/webapp python app.py
29cd64c0c282439d8fd6883f29d6a3a23cbef00bd0256ffb9e81561562ed0f5b
docker: Error response from daemon: driver failed programming external connectivity on endpoint laughing_austin
(e1b9e047d2e915fa77730e8d0e1c6c007a6034bcc782a441934b28ee91058256):
(COMMAND_FAILED: '/usr/sbin/iptables -w2 -t nat -A DOCKER -p tcp -d 0/0 --dport 32787 -j DNAT --to-destination 172.17.0.2:5000 ! -i docker0'
failed: iptables: No chain/target/match by that name.
).
经研究下,是防火墙的缘故。
在使用Docker时,启用centos7默认的firewall,启动端口映射时,防火墙规则不生效。docker默认使用了iptables防火墙机制。所以需要关闭firewall使用iptables解决。
①关闭默认firewall防火墙
systemctl stop firewalld.service 关闭防火墙 systemctl disable firewalld.service 关闭开机启动
②开启iptables
yum install iptables (根据centOS7的版本和内核,有些版本已经装过,可以跳过此命令)
yum install iptables-services
service iptables restart
chkconfig iptables on
或者
systemctl enable iptables.service 开机自启
③添加防火墙命令
/sbin/iptables -I INPUT -p tcp --dport -j ACCEPT 添加防火墙规则
iptables -L -n 查看防火墙的设置情况
上述步骤执行完成之后,docker运行该容器就能成功了。
docker 在centos6 和centos7上的区别的更多相关文章
- 如何在centos6和centos7上部署nfs共享服务器和客户端
nfs共享服务为中小型企业在存储上提供了有效的节省空间,许多大型的网站也在使用nfs,如百度和阿里等,下面结合自己所学的知识,阐述如何在centos6和centos7下配置nfs.注:除了必要的说明外 ...
- CentOS6与CentOS7的网络区别
回顾:物理层 关注的是接口物理特性,传输介质数据链路层 MAC地址,数据帧,以太网,交换机网络层 IP地址,数据包,IP\ICMP\ARP协议,路由器传输层 TCP.UDP,端口号,数据段应用层 HT ...
- 【docker】centOS7上部署的mysql和spring boot服务,要求,mysql的时间、java程序服务的时间和宿主机的时间完全保持一致【修改mysql时区,临时和永久】【修改spring boot配置文件时区】【修改docker启动spring boot实例程序时区】
要求:centOS7上部署的mysql和spring boot服务,要求,mysql的时间.java程序服务的时间和宿主机的时间完全保持一致: ============================ ...
- centos7上docker安装和使用教程
Docker 是一个创建和管理 Linux 容器的开源工具.容器就像是轻量级的虚拟机,并且可以以毫秒级的速度来启动或停止.Docker 帮助系统管理员和程序员在容器中开发应用程序,并且可以扩展到成千上 ...
- centos7上安装docker社区版
container(容器) docker(集装箱) 容器的优点 1. 启动速度快 2. 节省资源 3. 兼容性高 保证机器正常上网 #ping www.baidu.com CPU需要支持虚拟化 # g ...
- 2、centos6和centos7的区别
services使用了systemd来代替sysvinit管理. systemd是Linux下的一种init软件,由Lennart Poettering带头开发,并在LGPL 2.1及其后续版本许可证 ...
- Docker实践(6)—CentOS7上部署Kubernetes
Kubernetes架构 Kubernetes的整体架构如下: Master为主控节点,上面运行apiserver,scheduler,controller-manager等组件.Minion相当于工 ...
- Centos7上安装docker (转)
Centos7上安装docker Docker从1.13版本之后采用时间线的方式作为版本号,分为社区版CE和企业版EE. 社区版是免费提供给个人开发者和小型团体使用的,企业版会提供额外的收费服务,比如 ...
- 配置 Docker 加速器:适用于 Ubuntu14.04、Debian、CentOS6 、CentOS7、Fedora、Arch Linux、openSUSE Leap 42.1
天下容器, 唯快不破 Docker Hub 提供众多镜像,你可以从中自由下载数十万计的免费应用镜像, 这些镜像作为 docker 生态圈的基石,是我们使用和学习 docker 不可或缺的资源.为了解决 ...
随机推荐
- CentOS 7下用firewall-cmd
一 .控制端口/服务 可以通过两种方式控制端口的开放,一种是指定端口号另一种是指定服务名.虽然开放http服务就是开放了80端口,但是还是不能通过端口号来关闭,也就是说通过指定服务名开放的就要通过指定 ...
- Php中的goto用法
我们先举个简单示例: <?php goto LABEL; //这个标签自定义 echo '乔峰'; LABEL: echo '鸠摩智'; 以上例程会输出:鸠摩智 解释:goto 操作符可以用来跳 ...
- ajax点击加载更多数据图片(预加载)
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- 一句话总结K均值算法
一句话总结K均值算法 核心:把样本分配到离它最近的类中心所属的类,类中心由属于这个类的所有样本确定. k均值算法是一种无监督的聚类算法.算法将每个样本分配到离它最近的那个类中心所代表的类,而类中心的确 ...
- How to Apply Patches to a WLS 8.1 Environment
APPLIES TO: Oracle Weblogic Server - Version 8.1 to 8.1Information in this document applies to any p ...
- Android 解决通过自定义设置打开热点后手机搜索不到热点的问题。
开发过程中出现了通过自定义设置打开热点后手机搜索不到热点的问题. 后来通过观看 /data/misc/wifi 目录下的 hostapd.conf 文件,发现是 interface=ap0 d ...
- C++二分查找算法演示源码
如下内容段是关于C++二分查找算法演示的内容. #include <cstdio>{ int l = 0, r = n-1; int mid; while (l <= r){ mid ...
- Android相机启动crash错误排查
一个Android的用到相机的service程序,在比较少的情况下会出现在系统启动时crash.log显示是在调用ACameraDevice_createCaptureSession时返回错误ACAM ...
- adb server is out of date. killing完美解决
原本是想跑monkey测试的,可使用adb命令时提示:adb server is out of date. killing... 出现这个问题的原因是:adb使用的端口5037被占用了.下面我们说下如 ...
- vulnhub writeup - 持续更新
目录 wakanda: 1 0. Description 1. flag1.txt 2. flag2.txt 3. flag3.txt Finished Tips Basic Pentesting: ...
