I'll try build docker image with openvpn connect to HideMyAss VPN. Look at Dockerfile:
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get clean && apt-get -y update && apt-get install -y locales curl
RUN apt-get install -y php apache2 curl openvpn zip unzip bridge-utils
RUN apt-get install nano
RUN mkdir -p /dev/net && \
mknod /dev/net/tun c 10 200 && \
chmod 600 /dev/net/tun && \
cat /dev/net/tun
COPY tcp/Anguilla.TheValley.TCP.ovpn /etc/openvpn
COPY tcp/Angola.Luanda.TCP.ovpn /etc/openvpn
COPY tcp/Belgium.Brussels.TCP.ovpn /etc/openvpn
COPY tcp/pass.txt /etc/openvpn
EXPOSE 8888
RUN openvpn --config /etc/openvpn/Belgium.Brussels.TCP.ovpn
When I try build this code I have an error:
cat: /dev/net/tun: File descriptor in bad state
But if I remove this 2 lines:
cat /dev/net/tun
RUN openvpn --config /etc/openvpn/Belgium.Brussels.TCP.ovpn
than container successfully build and when I enter to him (docker exec) and run command
openvpn --config /etc/openvpn/Belgium.Brussels.TCP.ovpn
then all works fine.
Can somebody help me, why it doesn't work via image building?