Modified version of Christophs repo to work with docker-compose
Run openconnect VPN client inside a Docker container.
This allows one to share the same VPN connection between (many) different containers.
-
Specify credentials in
.env
file (seeenv-example
for reference) -
Start VPN Container:
docker-compose build vpn
docker-compose run --name konsti_vpn -d vpn
- Modify docker-compose of your development/production container to contain this line:
network_mode: container:konsti_vpn
full example of a production service in docker-compose
services:
gpu-server_production:
privileged: true
network_mode: container:konsti_vpn # this line has to mention the container above
build: .
volumes:
- /some:/mapping
env_file: .env
environment:
- DISPLAY=$DISPLAY
runtime: nvidia
entrypoint: /usr/local/bin/python3
command: run.py # now we dont need the vpn.sh script, but only the .py
- Start your develop/production containers with docker-compose run just as before.