qdm12 / gluetun

VPN client in a thin Docker container for multiple VPN providers, written in Go, and using OpenVPN or Wireguard, DNS over TLS, with a few proxy servers built-in.
https://hub.docker.com/r/qmcgaw/gluetun
MIT License
6.94k stars 337 forks source link

Bug: Cannot start service curl: network services:gluetun not found #204

Closed entrptaher closed 4 years ago

entrptaher commented 4 years ago

Cannot use the gluetun service in same docker file according to the documents.

  1. Is this urgent?

    • [x] Yes
    • [ ] No
  2. What VPN service provider are you using?

    • [x] PIA
    • [ ] Mullvad
    • [ ] Windscribe
    • [ ] Surfshark
    • [ ] Cyberghost
  3. What's the version of the program?

    See the line at the top of your logs

    gluetun    | Running version latest built on 2020-07-17T01:17:21Z (commit fab9939)
  4. What are you using to run the container?

    • [ ] Docker run
    • [x] Docker Compose
    • [ ] Kubernetes
    • [ ] Docker stack
    • [ ] Docker swarm
    • [ ] Podman
    • [ ] Other:
  5. Extra information

✅ docker run with network works

docker run --rm --network=container:gluetun alpine:3.12 wget -qO- "https://ifconfig.co/ip"
XX.XXX.XXX.XX

✅ container:gluetun works from another file

# save as curl.yml and run using this command
# docker-compose -f curl.yml up

version: "3.7"
services:
  curl:
    image: byrnedo/alpine-curl
    command: /usr/bin/curl -s "http://ifconfig.co/ip"
    network_mode: container:gluetun

❌ using same compose file fails.

version: "3.7"
services:

  gluetun:
    image: qmcgaw/private-internet-access
    container_name: gluetun
    cap_add:
      - NET_ADMIN
    devices:
      - "/dev/net/tun"
    ports:
      - 8000:8000/tcp
    environment:
      - VPNSP=private internet access
      - USER=${USER}
      - PASSWORD=${PASSWORD}
      - REGION=Singapore
    restart: always

  curl:
    image: byrnedo/alpine-curl
    command: /usr/bin/curl -s "http://ifconfig.co/ip"
    network_mode: services:gluetun

Log:

➜  docker-compose up
ERROR: for curl  Cannot start service curl: network services:gluetun not found
ERROR: Encountered errors while bringing up the project.

❌ Setting network_mode on gluetun service does not work

    network_mode: bridge

Host OS: Ubuntu 20.04 LTS

entrptaher commented 4 years ago

Doesn't this look like a typo? 🤦

service:gluetun
qdm12 commented 4 years ago

It happens to the best of us 😄 Glad you figured it out though, I would probably spent quite some time to find it as well haha