diff --git a/files/dockerd.init b/files/dockerd.init index 111e2cd..8835a6d 100755 --- a/files/dockerd.init +++ b/files/dockerd.init @@ -150,7 +150,7 @@ ucidel() { } process_config() { - local alt_config_file data_root log_level iptables bip + local alt_config_file data_root log_level iptables ip6tables bip [ -f /etc/config/dockerd ] || { # Use the daemon default configuration @@ -172,6 +172,7 @@ process_config() { config_get data_root globals data_root "/opt/docker/" config_get log_level globals log_level "warn" config_get_bool iptables globals iptables "1" + config_get_bool ip6tables globals ip6tables "0" # Don't add these options by default # omission == docker defaults @@ -184,12 +185,18 @@ process_config() { config_get ip globals ip "" config_get fixed_cidr globals fixed_cidr "" config_get fixed_cidr_v6 globals fixed_cidr_v6 "" + # Use the *_proxy environment variable as the default value + config_get http_proxy proxies http_proxy "${http_proxy}" + config_get https_proxy proxies https_proxy "${https_proxy}" + config_get no_proxy proxies no_proxy "${no_proxy}" + config_get storage_driver globals storage_driver "" . /usr/share/libubox/jshn.sh json_init json_add_string "data-root" "${data_root}" json_add_string "log-level" "${log_level}" json_add_boolean "iptables" "${iptables}" + json_add_boolean "ip6tables" "${ip6tables}" [ -z "${log_driver}" ] || json_add_string "log-driver" "${log_driver}" [ -z "${bip}" ] || json_add_string "bip" "${bip}" [ -z "${registry_mirrors}" ] || json_add_array "registry-mirrors" @@ -205,6 +212,14 @@ process_config() { [ -z "${ip}" ] || json_add_string "ip" "${ip}" [ -z "${fixed_cidr}" ] || json_add_string "fixed-cidr" "${fixed_cidr}" [ -z "${fixed_cidr_v6}" ] || json_add_string "fixed-cidr-v6" "${fixed_cidr_v6}" + if [ -n "${http_proxy}" ] || [ -n "${https_proxy}" ] || [ -n "${no_proxy}" ]; then + json_add_object "proxies" + [ -z "${http_proxy}" ] || json_add_string "http-proxy" "${http_proxy}" + [ -z "${https_proxy}" ] || json_add_string "https-proxy" "${https_proxy}" + [ -z "${no_proxy}" ] || json_add_string "no-proxy" "${no_proxy}" + json_close_object + fi + [ -z "${storage_driver}" ] || json_add_string "storage-driver" "${storage_driver}" json_dump > "${DOCKERD_CONF}" [ "${iptables}" -eq "1" ] && config_foreach iptables_add_blocking_rule firewall diff --git a/files/etc/config/dockerd b/files/etc/config/dockerd index dd75235..0fa4a56 100644 --- a/files/etc/config/dockerd +++ b/files/etc/config/dockerd @@ -21,6 +21,13 @@ config globals 'globals' # list registry_mirrors 'https://' # list registry_mirrors 'https://hub.docker.com' +# If your organization uses a proxy server to connect to the internet, you may need to configure the proxy. +# See https://docs.docker.com/engine/daemon/proxy/ for more details +config proxies 'proxies' +# option http_proxy 'http://proxy.example.com:3128' +# option https_proxy 'https://proxy.example.com:3129' +# option http_proxy '*.test.example.com,.example.org,127.0.0.0/8' + # Docker doesn't work well out of the box with fw4. This is because Docker relies on a compatibility layer that # naively translates iptables rules. For the best compatibility replace the following dependencies: # `firewall4` -> `firewall`