Skip to content

Commit

Permalink
Explain more about Docker and proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
medihack committed Sep 14, 2023
1 parent 5ad7b91 commit 095e24f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
15 changes: 15 additions & 0 deletions KNOWLEDGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@ E: Release file for http://security.debian.org/debian-security/dists/buster/upda
E: Release file for http://deb.debian.org/debian/dists/buster-updates/InRelease is not valid yet (invalid for another 17h 37min 38s). Updates for this repository will not be applied.
```

### Docker and proxies

Docker Compose does automatically set http_proxy, HTTP_PROXY, https_proxy,
HTTPS_PROXY, no_proxy and NO_PROXY with the values specified in
~/.docker/config.json. Unfortunately Docker Swarm does not set those value,
but those can be set by using environment variables, e.g. using an env file.
The proxy variables by the env file do overwrite the settings of config.json.
To make the proxy only available during building an image, but not when the
container runs (in Compose as in Swarm this is never the case), then set proxy
in config.json, but explicitly reset them in the env file. This seems to be
necessary as Playwright doesn't respect the no_proxy setup and may lead to
strange errors during integration testing.
See also <https://docs.docker.com/network/proxy/#configure-the-docker-client>
and <https://forums.docker.com/t/docker-swarm-mode-not-picking-up-proxy-configuration/132233/8?u=medihack>

## Gitpod

- It is not possible to set an ENV variable using the Gitpod Dockerfile
Expand Down
23 changes: 6 additions & 17 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,9 @@ SSL_IP_ADDRESSES=127.0.0.1
USER_TIME_ZONE=Europe/Berlin
FORCE_DEBUG_TOOLBAR=false
BACKUP_DIR=/mnt/backups

# Docker Compose does automatically set http_proxy, HTTP_PROXY, https_proxy,
# HTTPS_PROXY, no_proxy and NO_PROXY with the values specified in
# ~/.docker/config.json. Unfortunately Docker Swarm does not set those value,
# but those can be set by the environment variables in the env file.
# If those are set in Docker Compose mode the ones here overwrite those
# in the config.json file.
# Cave, those variables here doesn't have any effect when the image is build
# (only those in the config.json file work).
# See also https://docs.docker.com/network/proxy/#configure-the-docker-client
# and https://forums.docker.com/t/docker-swarm-mode-not-picking-up-proxy-configuration/132233/8?u=medihack
# http_proxy=http://user:pass@myproxy.net:8080
# HTTP_PROXY=http://user:pass@myproxy.net:8080
# https_proxy=http://user:pass@myproxy.net:8080
# HTTPS_PROXY=http://user:pass@myproxy.net:8080
# no_proxy=
# NO_PROXY=
http_proxy=
HTTP_PROXY=
https_proxy=
HTTPS_PROXY=
no_proxy=
NO_PROXY=

0 comments on commit 095e24f

Please sign in to comment.