license 'Apache 2.0'
description 'Installs/Configures Docker Engine.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version '0.3.5'
+version '0.3.6'
source_url 'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git'
issues_url 'https://osdn.jp/projects/metasearch/ticket'
supports 'ubuntu', '>= 14.04'
-depends 'platform_utils', '>= 0.4.2'
+depends 'platform_utils', '>= 0.4.4'
depends 'ssl_cert', '>= 0.3.2'
action :nothing
end
-directory '/etc/systemd/system/docker.service.d' do
- owner 'root'
- group 'root'
- mode '0755'
- action :create
-end
-
-template '/etc/systemd/system/docker.service.d/override.conf' do
- source 'etc/systemd/system/docker.service.d/override.conf'
- owner 'root'
- group 'root'
- mode '0644'
- not_if { node['docker-grid']['install_flavor'] == 'os-repository' && node['platform_family'] == 'rhel' }
- notifies :run, 'bash[systemctl_daemon-reload]', :immediately
- notifies :restart, 'service[docker]'
-end
-
case node['platform_family']
when 'rhel'
if node['docker-grid']['install_flavor'] == 'dockerproject'
resources(package: pkg_name) rescue package pkg_name do
action :install
- options '--allow-downgrades'
+ options '--allow-downgrades' if node['platform_version'] >= '16.04' # LTS (xenial)
version docker_ver
notifies :run, 'bash[clean_up_docker0_bridge]', :before
end
end
+docker_opts = []
+
+storage_driver = node['docker-grid']['engine']['storage-driver']
+docker_opts.push("--storage-driver=#{storage_driver}") if !storage_driver.nil? && !storage_driver.empty?
+
+userns_remap = node['docker-grid']['engine']['userns-remap']
+docker_opts.push("--userns-remap=#{userns_remap}") if !userns_remap.nil? && !userns_remap.empty?
+
+extra_options = node['docker-grid']['engine']['daemon_extra_options']
+# for docker-engine package on RHEL: remove '-H fd://'
+# https://github.com/docker/docker/issues/22847
+if (node['platform_family'] == 'rhel' || node['platform_version'] == '14.04') \
+ && Gem::Version.create(docker_ver.tr('~', '-')) >= Gem::Version.create('1.12')
+ extra_options.gsub!(%r{-H\sfd://}, '')
+end
+
+docker_opts.push(extra_options) if !extra_options.nil? && !extra_options.empty?
+
+init_package = node['init_package']
+if init_package == 'systemd'
+ directory '/etc/systemd/system/docker.service.d' do
+ owner 'root'
+ group 'root'
+ mode '0755'
+ action :create
+ end
+
+ template '/etc/systemd/system/docker.service.d/override.conf' do
+ source 'etc/systemd/system/docker.service.d/override.conf'
+ owner 'root'
+ group 'root'
+ mode '0644'
+ variables(
+ docker_opts: docker_opts
+ )
+ not_if { node['docker-grid']['install_flavor'] == 'os-repository' && node['platform_family'] == 'rhel' }
+ notifies :run, 'bash[systemctl_daemon-reload]', :immediately
+ notifies :restart, 'service[docker]'
+ end
+elsif init_package == 'init' # for Ubuntu 14.04,...
+ template '/etc/default/docker' do
+ source 'etc/default/docker'
+ owner 'root'
+ group 'root'
+ mode '0644'
+ variables(
+ docker_opts: docker_opts
+ )
+ notifies :restart, 'service[docker]'
+ end
+end
+
service 'docker' do
+ provider Chef::Provider::Service::Upstart if node['platform'] == 'ubuntu' && node['platform_version'] < '15.04'
action [:start, :enable]
subscribes :restart, 'execute[update-ca-certificates]', :delayed
end
--- /dev/null
+# Docker Upstart and SysVinit configuration file
+
+#
+# THIS FILE DOES NOT APPLY TO SYSTEMD
+#
+# Please see the documentation for "systemd drop-ins":
+# https://docs.docker.com/engine/admin/systemd/
+#
+
+# Customize location of Docker binary (especially for development testing).
+#DOCKERD="/usr/local/bin/dockerd"
+
+# Use DOCKER_OPTS to modify the daemon startup options.
+#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
+<% unless @docker_opts.empty? %>
+DOCKER_OPTS="<%= @docker_opts.join(' ') %>"
+<% end %>
+
+# If you need Docker to use an HTTP proxy, it can also be specified here.
+#export http_proxy="http://127.0.0.1:3128/"
+
+# This is also a handy place to tweak where Docker's temporary files go.
+#export DOCKER_TMPDIR="/mnt/bigdrive/docker-tmp"
-<%
-options = []
-
-storage_driver = node['docker-grid']['engine']['storage-driver']
-if !storage_driver.nil? && !storage_driver.empty?
- options.push("--storage-driver=#{storage_driver}")
-end
-
-userns_remap = node['docker-grid']['engine']['userns-remap']
-if !userns_remap.nil? && !userns_remap.empty?
- options.push("--userns-remap=#{userns_remap}")
-end
-
-extra_options = node['docker-grid']['engine']['daemon_extra_options']
-# for docker-engine package on RHEL: remove '-H fd://'
-# https://github.com/docker/docker/issues/22847
-if node['platform_family'] == 'rhel' \
- && Gem::Version.create(node['docker-grid']['engine']['version']) >= Gem::Version.create('1.12')
- extra_options.gsub!(%r{-H\sfd://}, '')
-end
-
-if !extra_options.nil? && !extra_options.empty?
- options.push(extra_options)
-end
--%>
[Service]
ExecStart=
-ExecStart=/usr/bin/docker daemon <%= options.join(' ') %>
+ExecStart=/usr/bin/docker daemon <%= @docker_opts.join(' ') %>