banner
libxcnya.so

libxcnya.so

Nothing...
telegram
twitter
github
email

Pulling docker compose through a proxy

Preface#

Recently, I don't know what the Ministry of Industry and Information Technology is up to. For a while, almost everything related to docker has been blocked.
So how can I docker compose pull?

Since all network events of docker go through its own docker0 network card, system settings like HTTP_PROXY are useless for docker...
So there are two ways to solve this.

Use OpenWrt#

The simplest and most direct method.
This method is suitable for use on your own devices. It is recommended to directly use OpenWrt and OpenClash for proxy.
You don't have to use Wrt, as long as you can proxy traffic at a higher level on the device.

Modify the dockerd file#

This method is universal but a bit more troublesome.
First, start a clash core locally and set up the proxy (or you can use another http proxy).
First, create a systemd folder for dockerd, note that the contents under this folder will replace the default configuration of docker

mkdir -p /etc/systemd/system/docker.service.d

Then create a file named http-proxy.conf in this directory and write the following content

[Service]
Environment="HTTP_PROXY=http://127.0.0.1:7890"
Environment="HTTPS_PROXY=http://127.0.0.1:7890"
Environment="NO_PROXY=ys.mihoyo.com,sr.mihoyo.com,mc.kurogames.com"

Save and restart the docker service

systemctl daemon-reload
systemctl restart docker

Check with docker info, you can see that the configuration has taken effect
1
Now we can happily do compose pull again~
2

Conclusion#

This tutorial ends here. If it has been helpful to you, feel free to share it with others.
And please give it a like, if you are able, consider supporting. Your likes are my motivation for updates, thank you meow

This article is synchronized and updated to xLog by Mix Space
The original link is https://blog.nekorua.com/posts/maintain/125.html


Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.