-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Version
22.7.0
Steps to Reproduce
I have a server, which can access the Internet only through http proxy. To make Docker access the Internet I perform 2 steps.
Step 1
Create file /etc/systemd/system/docker.service.d/http-proxy.conf with such contents:
[Service]
Environment="HTTP_PROXY=http://proxy:3128"
Environment="HTTPS_PROXY=http://proxy:3128"
Environment="NO_PROXY=127.0.0.0/8"
Where proxy is my proxy host. Then I reload systemd with a command systemctl daemon-reload and restart docker: systemctl restart docker.service.
These actions allow docker to perform docker pull command using http proxy.
Step2
Create file ~/.docker/config.json with such contents:
{
"proxies":
{
"default":
{
"httpProxy": "http://proxy:3128",
"httpsProxy": "http://proxy:3128",
"noProxy": "127.0.0.0/8"
}
}
}Where proxy is my proxy host. It sets http_proxy, https_proxy and no_proxy env variables in the docker containers, so it makes it possible to execute curl and other commands that require Internet access.
After it I try to execute install.sh.
Expected Result
Everything works as described in the README and the documentation.
Actual Result
Installation fails.
apt-get fails for cron container. It does not use proxy env variables and requires to configure proxies in the /etc/apt/apt.conf. So it can be fixed with such apt.conf:
Acquire::http::proxy "http://proxy:3128/";
Acquire::https::proxy "http://proxy:3128/";
And cron/Dockerfile should be modified like this:
ARG BASE_IMAGE
FROM ${BASE_IMAGE}
USER 0
COPY apt.conf /etc/apt/apt.conf # <-- this line added
RUN apt-get update && apt-get install -y --no-install-recommends cron && \
rm -r /var/lib/apt/lists/*
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
Even if I fix cron container problem - the installation fails again with such an error:
container for service "clickhouse" is unhealthy
An error occurred, caught SIGERR on line 3
In the docker-compose.yml there are such lines:
healthcheck:
test:
[
"CMD-SHELL",
"wget -nv -t1 --spider 'http://localhost:8123/' || exit 1",
]yandex/clickhouse-server:20.3.9.70 container has a wget from busybox, which ignores no_proxy env variable (take a look at this ticket for more details). So healthcheck command tries to make a request to the localhost though http proxy and fails.
It can be fixed with such command: HTTP_PROXY='' wget -nv -t1 --spider 'http://localhost:8123/' || exit 1.