N
N
Nikolay Baranenko2021-06-09 20:40:34
linux
Nikolay Baranenko, 2021-06-09 20:40:34

Why don't requests from Docker Container go through proxy?

Hello.

I want to load test the service inside and have the statistics uploaded to https://overload.yandex.net/

for this, when starting the container, I prescribe env

HTTP_PROXY and HTTPS_PROXY

docker run --rm -v /opt/docker/yandex.tank/her.ya.ru:/var/loadtest \
--env HTTP_PROXY="http://user:[email protected]:31310" \
--env HTTPS_PROXY="http://user:[email protected]:31310" \
--net host -it direvius/yandex-tank


the application starts up, I go into the container, ENV is correctly displayed there, I

do curl on https://overload.yandex.net/ - it goes fine,

but when it starts, an error is returned in the logs

ProxyError: HTTPSConnectionPool(host='overload.yandex.net', port=443)


tried another option

created file

/etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY= http://user:[email protected]:31310/ "
Environment="HTTPS_PROXY = http://user:[email protected]:31310/ "
Environment="NO_PROXY=localhost,127.0.0.0/8,her.ya.ru"

restarted

sudo systemctl daemon-reload
sudo systemctl restart docker.service

sudo systemctl show --property Environment docker

Environment=HTTP_PROXY=http://user:pwd@proxy.my:31310/ HTTPS_PROXY=http://user:pwd@proxy.my:31310/ NO_PROXY=localhost,127.0.0.0/8,her.ya.ru


all the same, the application from the container stubbornly climbs directly into the internet

. What could be the problem and how to solve it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question