Docker Daemon Proxy
The Docker daemon checks environment variables in its startup
environment.
Or you can
According to the official
Docker documentation
Create a directory and configuration file for the Docker service:
1 sudo mkdir -p /etc/systemd/system/docker.service.d/
Create
/etc/systemd/system/docker.service.d/http-proxy.conf with
your proxy settings:
1 2 3 4 [Service] Environment ="HTTP_PROXY=http://proxy.example.com:3128" Environment ="HTTPS_PROXY=https://proxy.example.com:3129" Environment ="NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp"
Apply the configuration changes:
1 2 sudo systemctl daemon-reloadsudo systemctl restart docker
Check that the environment variables are properly set:
1 sudo systemctl show --property=Environment docker
Nix Daemon Proxy
According to the Nixos
CN documentation
1 sudo mkdir -p /run/systemd/system/nix-daemon.service.d/
Create
/run/systemd/system/nix-daemon.service.d/override.conf with
your proxy settings:
1 2 3 4 sudo tee /run/systemd/system/nix-daemon.service.d/override.conf << EOF [Service] Environment="https_proxy=socks5h://localhost:7891" EOF
Apply the configuration changes:
1 2 sudo systemctl daemon-reloadsudo systemctl restart nix-daemon
PS
The NO_PROXY variable should include local addresses
and internal services that shouldn't go through the proxy
Different proxy protocols may be required (HTTP, HTTPS, SOCKS5)
depending on your network setup