|
| 1 | +# Docker + OpenVPN systemd Service |
| 2 | + |
| 3 | +The systemd service aims to make the update and invocation of the |
| 4 | +`docker-openvpn` container seamless. It automatically downloads the latest |
| 5 | +`docker-openvpn` image and instantiates a Docker container with that image. At |
| 6 | +shutdown it cleans-up the old container. |
| 7 | + |
| 8 | +In the event the service dies (crashes, or is killed) systemd will attempt to |
| 9 | +restart the service every 10 seconds until the service is stopped with |
| 10 | +`systemctl stop [email protected]`. |
| 11 | + |
| 12 | +A number of IPv6 hacks are incorporated to workaround Docker shortcomings and |
| 13 | +are harmless for those not using IPv6. |
| 14 | + |
| 15 | +To use and enable automatic start by systemd: |
| 16 | + |
| 17 | +1. Create a Docker volume container named `ovpn-data-NAME` where `NAME` is the |
| 18 | + user's choice to describe the use of the container. In the example |
| 19 | + configuration given in the [README](/README.md) `NAME=data`. |
| 20 | +2. Initialize the data container according to the [docker-openvpn |
| 21 | + README](/README.md), but don't start the container. Stop the Docker |
| 22 | + container if started. |
| 23 | +3. Download the [[email protected]](https://raw.githubusercontent.com/kylemanna/docker-openvpn/master/init/docker-openvpn%40.service) |
| 24 | + file to `/etc/systemd/system`: |
| 25 | + |
| 26 | + curl -L https://raw.githubusercontent.com/kylemanna/docker-openvpn/master/init/docker-openvpn%40.service | sudo tee /etc/systemd/system/[email protected] |
| 27 | + |
| 28 | +4. Enable and start the service with: |
| 29 | + |
| 30 | + systemctl enable --now [email protected] |
| 31 | + |
| 32 | +5. Verify service start-up with: |
| 33 | + |
| 34 | + systemctl status [email protected] |
| 35 | + journalctl --unit [email protected] |
| 36 | + |
| 37 | +For more information, see the [systemd manual pages](https://www.freedesktop.org/software/systemd/man/index.html). |
0 commit comments