From 1dcfad42aebbe8775d762d112eaecc8effda01d6 Mon Sep 17 00:00:00 2001 From: Maartje Eyskens Date: Sun, 17 Dec 2017 00:57:21 +0100 Subject: [PATCH] Allow the container to touch DNS (#300) --- openvpn/Dockerfile | 3 +++ openvpn/README.md | 7 +++++++ openvpn/docker-compose.yml | 1 + 3 files changed, 11 insertions(+) diff --git a/openvpn/Dockerfile b/openvpn/Dockerfile index fd2d948..35e1481 100644 --- a/openvpn/Dockerfile +++ b/openvpn/Dockerfile @@ -2,5 +2,8 @@ FROM alpine:latest RUN apk --no-cache add \ openvpn +RUN mkdir /usr/share/openvpn +RUN cp /etc/openvpn/* /usr/share/openvpn/ + WORKDIR /etc/openvpn ENTRYPOINT ["openvpn"] diff --git a/openvpn/README.md b/openvpn/README.md index 585df5b..ba20784 100644 --- a/openvpn/README.md +++ b/openvpn/README.md @@ -24,6 +24,13 @@ If you **don't** need to specify a password, you can use `docker-compose run -d If you OpenVPN configuration needs extra files (certificates etc) you can drop them in this directory too. +## How to fix DNS +To let OpenVPN change your resolv.conf file you need to add 2 scripts to your configuration to trigger the Alpine provided scripts. +``` +up /usr/share/openvpn/up.sh +down /usr/share/openvpn/down.sh +``` + ## Why? Because we're the containerati and we like when things are [neatly arranged in their boxes](https://twitter.com/zooeypeng/status/613053137050439681). diff --git a/openvpn/docker-compose.yml b/openvpn/docker-compose.yml index ac32f49..9112139 100644 --- a/openvpn/docker-compose.yml +++ b/openvpn/docker-compose.yml @@ -2,6 +2,7 @@ vpn: build: . volumes: - .:/etc/openvpn + - /etc/resolv.conf:/etc/resolv.conf net: host devices: - /dev/net/tun:/dev/net/tun