mirror of
https://github.com/Tecnativa/docker-socket-proxy
synced 2025-07-04 22:32:36 +00:00
Merge c66d752741
into 0e8d6601b6
This commit is contained in:
commit
a44f2448ac
@ -30,6 +30,11 @@ ENV ALLOW_RESTARTS=0 \
|
|||||||
SYSTEM=0 \
|
SYSTEM=0 \
|
||||||
TASKS=0 \
|
TASKS=0 \
|
||||||
VERSION=1 \
|
VERSION=1 \
|
||||||
VOLUMES=0
|
VOLUMES=0 \
|
||||||
|
TIMEOUT_HTTP_REQUEST=10s \
|
||||||
|
TIMEOUT_QUEUE=1m \
|
||||||
|
TIMEOUT_CONNECT=10s \
|
||||||
|
TIMEOUT_CLIENT=10m \
|
||||||
|
TIMEOUT_SERVER=10m
|
||||||
COPY docker-entrypoint.sh /usr/local/bin/
|
COPY docker-entrypoint.sh /usr/local/bin/
|
||||||
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg.template
|
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg.template
|
||||||
|
23
README.md
23
README.md
@ -143,6 +143,29 @@ extremely critical but can expose some information that your service does not ne
|
|||||||
- `TASKS`
|
- `TASKS`
|
||||||
- `VOLUMES`
|
- `VOLUMES`
|
||||||
|
|
||||||
|
##### Timeout Configuration
|
||||||
|
|
||||||
|
The Docker Socket Proxy allows configuration of various timeouts using environment variables. These timeouts control how long HAProxy waits for certain events before taking action. You can set these environment variables when running the Docker container to override the default values. Click each entry in the list to read the appropriate HAProxy Documentation.
|
||||||
|
|
||||||
|
- [`TIMEOUT_HTTP_REQUEST`](https://www.haproxy.com/documentation/haproxy-configuration-manual/latest/#timeout%20http-request): Maximum time to wait for a complete HTTP request. Default is `10s`.
|
||||||
|
- [`TIMEOUT_QUEUE`](https://www.haproxy.com/documentation/haproxy-configuration-manual/latest/#timeout%20queue): Maximum time a request can remain in the queue. Default is `1m`.
|
||||||
|
- [`TIMEOUT_CONNECT`](https://www.haproxy.com/documentation/haproxy-configuration-manual/latest/#timeout%20connect): Maximum time to wait for a connection attempt to a backend server. Default is `10s`.
|
||||||
|
- [`TIMEOUT_CLIENT`](https://www.haproxy.com/documentation/haproxy-configuration-manual/latest/#timeout%20client): Maximum inactivity time on the client side. Default is `10m`.
|
||||||
|
- [`TIMEOUT_SERVER`](https://www.haproxy.com/documentation/haproxy-configuration-manual/latest/#timeout%20server): Maximum inactivity time on the server side. Default is `10m`.
|
||||||
|
|
||||||
|
To set these timeouts, you can pass them as environment variables when starting the Docker container. For example:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker container run \
|
||||||
|
-d --privileged \
|
||||||
|
--name dockerproxy \
|
||||||
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
|
-p 127.0.0.1:2375:2375 \
|
||||||
|
-e TIMEOUT_HTTP_REQUEST=15s \
|
||||||
|
-e TIMEOUT_QUEUE=2m \
|
||||||
|
tecnativa/docker-socket-proxy
|
||||||
|
```
|
||||||
|
|
||||||
## Use a different Docker socket location
|
## Use a different Docker socket location
|
||||||
|
|
||||||
If your OS stores its Docker socket in a different location and you are unable to bind
|
If your OS stores its Docker socket in a different location and you are unable to bind
|
||||||
|
@ -15,7 +15,13 @@ case "$DISABLE_IPV6_LOWER" in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# Process the HAProxy configuration template using sed
|
# Process the HAProxy configuration template using sed
|
||||||
sed "s/\${BIND_CONFIG}/$BIND_CONFIG/g" /usr/local/etc/haproxy/haproxy.cfg.template > /usr/local/etc/haproxy/haproxy.cfg
|
sed -e "s|\${BIND_CONFIG}|$BIND_CONFIG|g" \
|
||||||
|
-e "s|\${TIMEOUT_HTTP_REQUEST}|$TIMEOUT_HTTP_REQUEST|g" \
|
||||||
|
-e "s|\${TIMEOUT_QUEUE}|$TIMEOUT_QUEUE|g" \
|
||||||
|
-e "s|\${TIMEOUT_CONNECT}|$TIMEOUT_CONNECT|g" \
|
||||||
|
-e "s|\${TIMEOUT_CLIENT}|$TIMEOUT_CLIENT|g" \
|
||||||
|
-e "s|\${TIMEOUT_SERVER}|$TIMEOUT_SERVER|g" \
|
||||||
|
/usr/local/etc/haproxy/haproxy.cfg.template > /usr/local/etc/haproxy/haproxy.cfg
|
||||||
|
|
||||||
# first arg is `-f` or `--some-option`
|
# first arg is `-f` or `--some-option`
|
||||||
if [ "${1#-}" != "$1" ]; then
|
if [ "${1#-}" != "$1" ]; then
|
||||||
|
10
haproxy.cfg
10
haproxy.cfg
@ -15,11 +15,11 @@ defaults
|
|||||||
option http-server-close
|
option http-server-close
|
||||||
option redispatch
|
option redispatch
|
||||||
retries 3
|
retries 3
|
||||||
timeout http-request 10s
|
timeout http-request ${TIMEOUT_HTTP_REQUEST}
|
||||||
timeout queue 1m
|
timeout queue ${TIMEOUT_QUEUE}
|
||||||
timeout connect 10s
|
timeout connect ${TIMEOUT_CONNECT}
|
||||||
timeout client 10m
|
timeout client ${TIMEOUT_CLIENT}
|
||||||
timeout server 10m
|
timeout server ${TIMEOUT_SERVER}
|
||||||
timeout http-keep-alive 10s
|
timeout http-keep-alive 10s
|
||||||
timeout check 10s
|
timeout check 10s
|
||||||
maxconn 3000
|
maxconn 3000
|
||||||
|
Loading…
Reference in New Issue
Block a user