Docker still connected to VPN after deletion of device on portal

created several docker containers that require --net=host option for other reason. using tutorial and running docker run -it -v /dev/net/tun:/dev/net/tun --cap-add NET_ADMIN --net=host husarnet_client.

Have successful join vpn server (only need to do that for one of the 4 dockers that is running on the same local machine, i.e. a single ipv6 address only) and tested that all clients (total 5) can talk to one another.

However, I would like to change to another husarnet VPN. Even if I removed the client via husarnet portal, I am still connected to the old VPN, gives a different ipv6 each time which is not registered/ shown in the husarnet portal. Also unable to husarnet join <newVPNcode>, it keeps printing joining... forever. How can i remove the old VPN?

TLDR docker container persist connection to old husarnet VPN after removing device from the VPN. How can i remove the old VPN?

Hi Leia!

That’s strange. Removing device from old VPN network is enough to make it possible to connect to other VPN network by using an Join Code. A proper way to run a container with Husarnet inside is:

sudo docker run --rm -it \
--env HOSTNAME='my-container-1' \
--env JOINCODE='fc94:b01d:1803:8dd8:3333:2222:1234:1111/xxxxxxxxxxxxxxxxx' \
--volume husarnet-ssh-v:/var/lib/husarnet \
--device /dev/net/tun \
--cap-add NET_ADMIN \
--sysctl net.ipv6.conf.all.disable_ipv6=0 \

It also looks like the article you mentioned needs to be updated. I will do that soon, but before that, please read our two blog posts about using Husarnet with Docker:


Solution presented in the second article is recommended (it’s quite fresh).

Please take a look at the solutions presented in those articles and let me know whether you have found a way to fix your issues.