Docker image for OpenVPN client/server.
This container can run as an OpenVPN server or as an OpenVPN client and provide a VPN tunnel for
other containers to utilize via Docker's shared networking stack (i.e. --net container:[NAME]
).
Place your OpenVPN client/server configuration file in a directory on your host file system
(i.e. /srv/openvpn
) with the name openvpn.conf
. You should also place your client/server certs,
keys and any additional files required in this directory.
Run the OpenVPN container and map your local config directory (/srv/openvpn
) to the container
config directory (/vol/config
) and map ports to your host OS:
docker run -d -v /srv/openvpn:/vol/config -p 443:443 -p 943:943 -p 1194:1194/udp --privileged --name openvpn-server phlak/openvpn --server [NETWORK] [NETMASK]
Run the OpenVPN container and map your local config directory (/srv/openvpn
) to the container
config directory (/vol/config
):
docker run -d -v /srv/openvpn:/vol/config --privileged --name openvpn-client phlak/openvpn
Now you can start up another container with a shared network stack to the OpenVPN container:
docker run -d --net container:openvpn-client --name container-name alpine
This container will now be reliant on the OpenVPN container's network stack for network access.
-p 1234:1234
- Map a port on the host OS to the OpenVPN container. When running as a client this
will pass ports through to containers that share the OpenVPN container's network
stack (i.e. When ran with the --net container:openvpn-client
parameter).
--restart always
- Always restart the container regardless of the exit status. See the Docker
restart policies for additional details.
When running a client container, if you are having trouble making a connection and docker logs
shows Initialization Sequence Completed
without indicatiing any problems try manually setting your
container's DNS servers by adding --dns 1.1.1.1 --dns 1.0.0.1
to your run command. Once your
container is running check you DNS name servers with:
docker exec transmission-vpn cat /etc/resolv.conf
For general help and support join our GitHub Discussions or reach out on Twitter.
Please report bugs to the GitHub Issue Tracker.
This project is licensed under the MIT License.