To configure web proxy networking options, create the drop-in file/etc/systemd/system/docker.service.d/http-proxy.confthat contains the following lines: [Service]
Environment="HTTP_PROXY=proxy_URL:port"
Environment="HTTPS_PROXY=proxy_URL:port"
Replaceproxy_URLandportwith the appropriate URLs and port numbers for your web proxy.
配置ipv6
To configure IPv6 support in version 1.5 and later of Docker, create the drop-in file/etc/systemd/system/docker.service.d/docker-network.confso that the definition ofOPTIONSincludes the--ipv6option, for example: [Service]
Environment="OPTIONS=$OPTIONS \"--ipv6\""
With IPv6 enabled, Docker assigns the link-local IPv6 addressfe80::1to the bridgedocker0.
If you want Docker to assign global IPv6 addresses to containers, additionally specify the IPv6 subnet to the--fixed-cidr-v6option, for example: [Service]
Environment="OPTIONS=$OPTIONS \"--ipv6 --fixed-cidr-v6='2001:db8:1::/64'\""
For more information about configuring Docker networking, seehttps://docs.docker.com/articles/networking/.
使用btrf格式的存储需要关闭selinux
To be able to use the btrfs storage engine with Docker on Oracle Linux 7, you must either set the SELinux mode to Permissive or disable SELinux altogether.
To set the current SELinux mode toPermissive, enter: # setenforce Permissive
This setting does not persist across reboots. To configure the default SELinux mode, edit/etc/selinux/configand set the value of theSELINUXdirective todisabledorpermissive.
To disable SELinux:
Edit/etc/selinux/configand set the value of theSELINUXdirective todisabled.
Reboot the system. # systemctl reboot
A bug in Docker version 1.8 prevents Docker from starting if both SELinux andfirewalldare enabled.
The workaround is to disable either SELinux orfirewalld. If you do not disable SELinux to use the btrfs storage engine with Docker, disablefirewalld. If you require a system firewall, you can useiptablesandip6tablesinstead offirewalld.
To stop and disablefirewalld, enter the following commands:
根据以往案例bug,建议关闭防火墙和selinux # systemctl stop firewalld
# systemctl disable firewalld
如果不关闭disable selinux 请安装如下
If you do not disable SELinux, install theselinux-policy-targetedpackage. # yum install selinux-policy-targeted
开机启动docker
Start thedockerservice and configure it to start at boot time. # systemctl start docker
# systemctl enable docker
ln -s '/etc/systemd/system/docker.service' \
'/etc/systemd/system/multi-user.target.wants/docker.service'
Note
If you have installed themlocatepackage, it is recommended that you modify thePRUNEPATHSentry in/etc/updatedb.confto preventupdatedbfrom indexing directories below/var/lib/docker, for example:
PRUNEPATHS="/media /tmp /var/lib/docker /var/spool /var/tmp"
This entry preventslocatefrom reporting files that belong to Docker containers.
To check that thedockerservice is running, use the following command:
# systemctl status docker
docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
Drop-In: /etc/systemd/system/docker.service.d
└─docker-sysconfig.conf, http-proxy.conf, var-lib-docker-mount.conf
Active: active (running) since Fri 2015-09-11 07:30:56 AEST; 700ms ago
Docs: https://docs.docker.com
Main PID: 2711 (docker)
CGroup: /system.slice/docker.service
└─2711 /usr/bin/docker daemon -H fd:// --ipv6 --fixed-cidr-v6='2001:db8:1::/64'
...
You can also use thedockercommand to display information about the configuration and version of the Docker Engine, for example:
# docker info
Containers: 0
Images: 6
Storage Driver: btrfs
Execution Driver: native-0.2
Kernel Version: 3.8.13-35.3.1.el7uek.x86_64
Operating System: Oracle Linux Server 7.0
# docker version
Client version: 1.3.3
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): 4e9bbfa/1.3.3
OS/Arch (client): linux/amd64
Server version: 1.3.3
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): 4e9bbfa/1.3.3