Open gbraad opened 1 year ago
"[ ! "$(docker ps -a | grep tailscaled)" ] && docker run -d --name=tailscaled -v /var/run/tailscale/:/var/run/tailscale/ -v /var/lib:/var/lib -v /dev/net/tun:/dev/net/tun --network=host --cap-add=NET_ADMIN --cap-add=NET_RAW --cap-add=SYS_MODULE --env TS_SOCKET=/var/run/tailscale/tailscale.sock --env TS_AUTHKEY=${TS_AUTHKEY} tailscale/tailscale"
Better to move this to scripts/start-tailscale
if [ ! "$(docker ps -a -q -f name=tailscaled)" ]; then
if [ "$(docker ps -aq -f status=exited -f name=tailscaled)" ]; then
# cleanup
docker rm tailscaled
fi
docker run -d --name=tailscaled \
-v /var/run/tailscale/:/var/run/tailscale/ \
-v /var/lib:/var/lib \
-v /dev/net/tun:/dev/net/tun \
--network=host \
--cap-add=NET_ADMIN \
--cap-add=NET_RAW \
--cap-add=SYS_MODULE \
--env TS_SOCKET=/var/run/tailscale/tailscale.sock \
--env TS_AUTHKEY=${TS_AUTHKEY}
tailscale/tailscale
fi
Check if the container already exists
https://github.com/gbraad/devenv-csb/blob/2c8462ed0f3b2e7eeab52f6f3830af0671b52bb9/.codesandbox/tasks.json#LL6C18-L6C319
... and if so, (re)start it.