Docker Daemon Proxy
The Docker daemon checks environment variables in its startup environment.
According to the official Docker documentation
Create a directory and configuration file for the Docker service:
sudo mkdir -p /etc/systemd/system/docker.service.d/Create /etc/systemd/system/docker.service.d/http-proxy.conf with your proxy settings:
[Service]Environment="HTTP_PROXY=http://proxy.example.com:3128"Environment="HTTPS_PROXY=http://proxy.example.com:3128"Environment="NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp"HTTPS_PROXY selects a proxy for HTTPS destinations; its URL scheme describes the connection to the proxy. An HTTP CONNECT proxy normally uses http:// for both variables. Use https://proxy.example.com:3129 only when that proxy endpoint itself supports TLS. Put comments on their own lines, not after Environment= assignments. Restarting Docker can interrupt running containers; plan the restart for your host.
Apply the configuration changes:
sudo systemctl daemon-reloadsudo systemctl restart dockerCheck that the environment variables are properly set:
sudo systemctl show --property=Environment dockerNix Daemon Proxy
According to the Nixos CN documentation
The /run drop-in below is temporary and disappears at reboot. On a non-NixOS systemd installation, use /etc/systemd/system/nix-daemon.service.d/override.conf for a persistent drop-in instead (create that directory first). On NixOS, prefer systemd.services.nix-daemon.environment.https_proxy in the declarative configuration and rebuild through your normal workflow; do not treat the runtime drop-in as persistent configuration. The SOCKS example requires a SOCKS endpoint at that port and support in the installed Nix HTTP transport.
sudo mkdir -p /run/systemd/system/nix-daemon.service.d/Create /run/systemd/system/nix-daemon.service.d/override.conf with your proxy settings:
sudo tee /run/systemd/system/nix-daemon.service.d/override.conf << EOF[Service]Environment="https_proxy=socks5h://localhost:7891"EOFApply the configuration changes:
sudo systemctl daemon-reloadsudo systemctl restart nix-daemonPS
- The
NO_PROXYvariable 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