openwrt docker pull 拉取镜像时使用 http 代理
修改 /etc/init.d/dockerd
使用 procd_set_param env
设置环境变量
原脚本:
start_service() { local nofile=$(cat /proc/sys/fs/nr_open) process_config procd_open_instance procd_set_param stderr 1 if [ -z "${DOCKERD_CONF}" ]; then procd_set_param command /usr/bin/dockerd else procd_set_param command /usr/bin/dockerd --config-file="${DOCKERD_CONF}" fi procd_set_param limits nofile="${nofile} ${nofile}" procd_close_instance }
新脚本:
start_service() { local nofile=$(cat /proc/sys/fs/nr_open) process_config procd_open_instance # set proxy procd_set_param env HTTP_PROXY=http://192.168.100.54:7890 procd_set_param env HTTPS_PROXY=http://192.168.100.54:7890 procd_set_param stderr 1 if [ -z "${DOCKERD_CONF}" ]; then procd_set_param command /usr/bin/dockerd else procd_set_param command /usr/bin/dockerd --config-file="${DOCKERD_CONF}" fi procd_set_param limits nofile="${nofile} ${nofile}" procd_close_instance }
新增了红色部分