{"id":13548233,"url":"https://github.com/nickkjolsing/dockerMullvadVPN","last_synced_at":"2025-04-02T21:31:03.208Z","repository":{"id":46971620,"uuid":"279013865","full_name":"nickkjolsing/dockerMullvadVPN","owner":"nickkjolsing","description":"Mullvad VPN container tutorial for docker","archived":false,"fork":false,"pushed_at":"2023-11-26T17:10:29.000Z","size":48,"stargazers_count":87,"open_issues_count":4,"forks_count":11,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-03T17:38:28.743Z","etag":null,"topics":["container","docker","mullvad","tutorial","vpn"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nickkjolsing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-07-12T07:25:00.000Z","updated_at":"2024-11-02T11:14:29.000Z","dependencies_parsed_at":"2024-03-16T17:37:43.311Z","dependency_job_id":"a9492b8d-bee3-4fbb-987c-712ef618e77d","html_url":"https://github.com/nickkjolsing/dockerMullvadVPN","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickkjolsing%2FdockerMullvadVPN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickkjolsing%2FdockerMullvadVPN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickkjolsing%2FdockerMullvadVPN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nickkjolsing%2FdockerMullvadVPN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nickkjolsing","download_url":"https://codeload.github.com/nickkjolsing/dockerMullvadVPN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246895680,"owners_count":20851311,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["container","docker","mullvad","tutorial","vpn"],"created_at":"2024-08-01T12:01:07.679Z","updated_at":"2025-04-02T21:31:02.915Z","avatar_url":"https://github.com/nickkjolsing.png","language":"Dockerfile","funding_links":[],"categories":["Dockerfile"],"sub_categories":[],"readme":"# mullvadVPN Docker container\n![Image of Docker](https://d1q6f0aelx0por.cloudfront.net/product-logos/644d2f15-c5db-4731-a353-ace6235841fa-registry.png) ![Image of Mullvad](https://www.aeres-evaluation.fr/wp-content/uploads/2019/07/mullvad-vpn-logo.png)\n### Mullvad VPN container for docker. Example on how to setup Transmission with container at the bottom of the page.  \n#### [Docker container that this relys on](https://github.com/yacht7/docker-openvpn-client)\n\n# \n\n#### Prerequisites\n- Docker installed (I'm using 19.03.8 Desktop on macOS)\n- [Mullvad](https://mullvad.net/) account (can be done with other providers, I completed with Mullvad) \n\n# \n\n###### Assuming environment is setup and you know drive mount locations. \n### Step 1: Getting Mullvad configuration .zip file\n1. Login [to account on Mullvad.net](https://mullvad.net/en/account/#/)\n2. Visit: [OpenVPN configuration file generator on their website](https://mullvad.net/en/account/#/openvpn-config/?platform=linux)\n3. Select your favorite country and city within that country!\n4. Under advanced settings: toggle ```UDP 53```\n5. Download zip archive, unarchive it into a regular folder, and place within a directory accessable by your Docker containers\n6. Return to ```My account``` and click [Port forwarding](https://mullvad.net/en/account/#/port-forwarding)\n7. Choose a city from the country you want to route through from the `Select a city` dropdown\n8. Set the `Select a device` dropdown to `No device (only OpenVPN)` and click the `Add port` green button\n9. Make a note of the full new value shown under `ACTIVE PORTS` - e.g. `nl-ams-59103` (country-city-port)\n\n### Step 2: Setup ```docker-compose``` file\n \n    ---\n    version: \"3\"\n    services:\n      openvpn-client:\n        image: ghcr.io/wfg/openvpn-client       # Image on Docker. Shoutout to ghcr.io\n        container_name: openvpn-client\n        cap_add:\n            - NET_ADMIN                         # Needs to be here\n        environment: \n            - KILL_SWITCH=on                         # Turns off internet access if the VPN connection drops\n            - FORWARDED_PORTS=nl-ams-59103           # Enter the full value you noted at step 9 above\n            - SUBNETS=192.168.0.0/24,192.168.1.0/24  # Allows for the service to be accessed through LAN\n        devices:\n            - /dev/net/tun                      \n        volumes:\n            - /Volumes/Luigi/docker/mullvadVPN/config/mullvad_config_linux_ch_zrh:/data/vpn   \n            # File unzipped before from Mullvad, it's location. Make sure to keep the \":/data/vpn\" part at the end\n        ports:\n            - 5665:5665                         # Opening port for to access hypothetical Transmission container that would be routing through this VPN\n            - 1500:1500                         # Opening port for other application routing through VPN\n        restart: unless-stopped\n\n### Step 3: Confirming VPN connection is active within container\n1. ```cd``` into folder where the ```docker-compose.yml``` for this container is stored\n2. Awaken the beast with ```docker-compose up```\n3. Let's get [jiggy](https://youtu.be/3JcmQONgXJM?t=1) wit that sparkly new container:\n    1. In a new terminal window, find docker container ID ```docker ps```\n    2. Type ```docker exec -it \u003ccontainer ID from above\u003e /bin/sh```\n    3. Now that you're into the shell of your VPN container we're going to check it's public IP\n    4. ```wget -qO- http://ipecho.net/plain | xargs echo``` will return your container's public IP\n    5. Lookup this IP's information to see if it's the same country/city you setup in your docker compose file. I'll let you find a site\n\n\nNow go browse the internet from 🇨🇭Switzerland or something\n# \n## Bonus section: Route other container's connection through this VPN\nSo you want to allow other containers to use this connection? Ok fine...\n#### Add ```network_mode: container:openvpn-client``` to the container's compose file\n#### Add ```ports:``` to the VPN's compose file\n\n### Hypothetical Transmission example\n1. Add ```network_mode: container:openvpn-client``` to docker compose file\n2. Make sure to add ports to VPN docker compose file, like in my example above\n    1. These ports will be the ports required by the application running in the container you're routing through the VPN. Ex: 5665 would be to access the Transmission Web UI in this situation\n\n---\n    version: \"2.1\"\n    services:\n      transmission:\n        image: linuxserver/transmission\n        container_name: transmission\n        environment:\n          - PUID=1000\n          - PGID=1000\n          - TZ=America/Denver\n        volumes:\n          - \u003cConfig location\u003e:/config\n          - \u003cDownload location\u003e:/downloads\n          - \u003cWatch location\u003e:/watch\n        network_mode: container:openvpn-client      # The addition to add to all containers that you want to route through VPN container\n        restart: unless-stopped\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickkjolsing%2FdockerMullvadVPN","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickkjolsing%2FdockerMullvadVPN","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickkjolsing%2FdockerMullvadVPN/lists"}