Simon536 / pi-tailscale-stack

Build a Portainer stack to run Tailscale in a Docker container on a Raspberry Pi
GNU Affero General Public License v3.0
12 stars 3 forks source link

Portainer issues #2

Open looeee opened 1 year ago

looeee commented 1 year ago

Thanks for sharing this, it's helpful while I am learning docker.

To get this to work in portainer I had to remove these lines:

    build:
      context: ./build
      dockerfile: Dockerfile

I also changed the image to latest

    image: tailscale/tailscale:stable

Then the container deploy successfully

Simon536 commented 1 year ago

Glad that this was helpful when setting up your own docker environment.

The main point of that build that you removed to get your container working was to add the Tailscale key to the container. Did you do that manually instead?

looeee commented 1 year ago

Ah that makes sense. Yes I added the key as an environment variable.

After setting this up I also had to add:

command: tailscaled

And from another guide I added these lines, although I'm not sure if they were needed.

cap_add:                           
    - net_admin
    - sys_module

And finally once it was running, I had to run a command from within the container:

docker exec -it tailscale tailscale up
gurues commented 1 year ago

Eso tiene sentido. Sí, agregué la clave como una variable de entorno.

Después de configurar esto, también tuve que agregar:

command: tailscaled

Y de otra guía agregué estas líneas, aunque no estoy seguro si hacían falta.

cap_add:                           
    - net_admin
    - sys_module

Y finalmente, una vez que se estaba ejecutando, tuve que ejecutar un comando desde dentro del contenedor:

docker exec -it tailscale tailscale up

Hello Can you share the final docker-compose and the steps I'm going crazy

Thank you

looeee commented 1 year ago
version: "3"

services:
  tailscale:
    image: tailscale/tailscale:stable
    container_name: tailscale
    environment:
      - SECRET_AUTH_KEY
    volumes:
      - /var/lib:/var/lib
      - /dev/net/tun:/dev/net/tun
    cap_add:                   
        - net_admin
        - sys_module
    command: tailscaled
    privileged: true
    network_mode: "host"
    restart: unless-stopped

Once the container is uo you need to run the command

docker exec -it tailscale tailscale up --advertise-exit-node

It took me a while to get this working but in the end, the problem was not docker, it was that I didn't fully understand Tailscale and VPNs. Took me some research to work everything out but it's been smooth sailing since.