Skip to content

Instantly share code, notes, and snippets.

@linux4life798
Last active February 2, 2026 18:51
Show Gist options
  • Select an option

  • Save linux4life798/1ab7189fe1146de3f1868885f677ccab to your computer and use it in GitHub Desktop.

Select an option

Save linux4life798/1ab7189fe1146de3f1868885f677ccab to your computer and use it in GitHub Desktop.
Setup Portainer on Debian with Tailscale

https://docs.portainer.io/start/install-ce/server/docker/linux

sudo apt install docker.io
sudo docker volume create portainer_data
sudo docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
sudo tailscale serve --bg https+insecure://localhost:9443

Checkout https://docs.portainer.io/start/install-ce/server/swarm/linux for info about setup using a Docker swarm.


portainer-install-upgrade.bash:

#!/bin/bash
#
# Install or upgrade portainer

msg-run() {
    echo -e "\E[1;32m$*\E[m" >&2
    "$@"
    local status="$?"
    echo -e "\E[1;33mExited with ${status}.\E[m"
    return $?
}

msg-run docker stop portainer
msg-run docker rm portainer
msg-run docker pull portainer/portainer-ce:latest

DOCKER_OPTS=( )
DOCKER_OPTS+=( --name portainer )
DOCKER_OPTS+=( -d )
DOCKER_OPTS+=( --restart=always )
DOCKER_OPTS+=( -p 8000:8000 )
DOCKER_OPTS+=( -p 9443:9443 )
DOCKER_OPTS+=( -v /var/run/docker.sock:/var/run/docker.sock )
DOCKER_OPTS+=( -v portainer_data:/data )
msg-run docker run "${DOCKER_OPTS[@]}" portainer/portainer-ce:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment