horsemaster
horsemaster

Reputation: 91

Error connecting to VPN within Docker container

I have an Ubuntu docker container with openvpn installed, and a config.ovpn file.

I try doing: openvpn --config config.ovpn

and get the following error:

ERROR: Cannot ioctl TUNSETIFF tun: Operation not permitted (errno=1)

Some googling seems to suggest that this is because of not running with sudo but does root not already have sudo permissions? (For what it's worth - running sudo openvpn makes no difference).

Upvotes: 4

Views: 2078

Answers (2)

dkurzaj
dkurzaj

Reputation: 356

You can simply add the right capacity to the container by giving the --cap-add NET_ADMIN parameter to docker run.

Upvotes: 2

horsemaster
horsemaster

Reputation: 91

Adding --privileged flag to docker run solved the problem.

Upvotes: 2

Related Questions