Skip to content
This repository has been archived by the owner on Jul 2, 2023. It is now read-only.

Commit

Permalink
Add the expose docker option (#9)
Browse files Browse the repository at this point in the history
This example details how can socat container communicates with another
docker container that relies on docker exposed ports, like nginx-proxy
image.
  • Loading branch information
leleobhz committed Jan 7, 2021
1 parent 6d9b8b8 commit 7b73382
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,36 @@ $ docker run \
* To automatically start the container on restart insert ```--restart always``` after ```docker run```.
* To automatically start the container unless it has been stopped explicitly insert ```--restart unless-stopped``` after ```docker run```.

## Use Case: Use nginx-proxy to access a local Cockpit instance

Socat docker image by defintion does not use any EXPOSE inside Dockerfile. This may prejudice other containers that rely on this information, like nginx-proxy (https://github.com/nginx-proxy/nginx-proxy).

Using expose will allow nginx-proxy to properly detect and communicate with socat instance without opening the port on host like ports option does.

### Example
In the following example, socat will be used to relay a host Cockpit instance to the nginx-proxy image, allowing to rely on proxy ports and optional Let's Encrypt support.

```
cockpit-relay:
image: alpine/socat
container_name: cockpit-relay
depends_on:
- nginx-proxy
command: "TCP-LISTEN:9090,fork,reuseaddr TCP:172.17.0.1:9090"
expose:
- "9090"
environment:
- VIRTUAL_HOST=somehost.somedomain
- VIRTUAL_PROTO=https
- LETSENCRYPT_HOST=somehost.somedomain
- [email protected]
restart: unless-stopped
logging:
driver: journald
networks:
- webservices
```

# The Processes to build this image

* Enable Travis CI cronjob on this repo to run build daily on master branch
Expand Down

0 comments on commit 7b73382

Please sign in to comment.