How to Install Docker Portainer on Debian 11

Install docker portainer on Debian 11 with Docker Engine, persistent storage, loopback-only HTTPS, an SSH tunnel, verification, and common fixes.
A 3D Debian-themed server rack with glowing container blocks and a secure dashboard panel on a midnight-blue background.

Install docker portainer on Debian 11 and finish with Docker Engine plus a persistent Portainer CE dashboard in about ten minutes. This setup keeps the management UI on the server’s loopback address and reaches it safely through an SSH tunnel.

Prerequisites

  • A 64-bit Debian 11 (Bullseye) VPS with at least 2 GB of RAM and 10 GB of free disk space for images, containers, and Portainer data.
  • Root access, or a normal SSH account that can run commands with sudo.
  • Outbound HTTPS access to Docker’s package repository and Docker Hub.
  • An SSH client on your own computer. A domain is not needed for the private tunnel in this guide.
  • A VPSLake Linux VPS with root access if you need a Debian server for Docker workloads.

Debian 11 is an older Bullseye release. Keep a migration to Debian 12 or 13 on your maintenance plan, especially if Docker stops publishing Bullseye packages for your architecture. The commands below use Bullseye explicitly so APT cannot accidentally select an Ubuntu repository or a different Debian release.

The commands assume a regular sudo-enabled account. If you are logged in as root, remove sudo from the commands.

Step 1: Confirm Bullseye and update APT

Checking the release first prevents a repository for Bookworm, Trixie, or Ubuntu from being added to the wrong system.

. /etc/os-release && printf 'ID=%s\nVERSION_ID=%s\nVERSION_CODENAME=%s\n' "$ID" "$VERSION_ID" "$VERSION_CODENAME"
uname -m
sudo apt-get update
sudo apt-get full-upgrade -y

The release should be Debian 11 with the bullseye codename, and most VPSs will report x86_64:

ID=debian
VERSION_ID="11"
VERSION_CODENAME=bullseye
x86_64

If the first command reports another release, stop here and use that release’s Docker instructions. Do not force Bullseye packages onto it.

Step 2: Clear conflicting container packages

Debian’s docker.io, standalone containerd, and an older Compose package can conflict with Docker’s Engine packages, so remove only packages that are actually installed.

dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' docker.io docker-compose docker-doc docker-buildx podman-docker containerd runc 2>/dev/null | awk '$1 ~ /^ii/ {print $2}' | xargs -r sudo apt-get remove -y

No output means none of those packages were installed. Removing packages this way does not erase Docker images, containers, or volumes under /var/lib/docker/; do not run a purge on a host that already runs important workloads without a backup.

Step 3: Add Docker’s signed Debian repository

Docker’s repository supplies Docker Engine, its CLI, containerd.io, Buildx, and the Compose plugin as a coordinated set. The key is stored in APT’s per-repository keyring instead of the deprecated global apt-key store.

sudo apt-get install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian bullseye stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

Check that APT sees Docker packages before installing them:

apt-cache policy docker-ce | sed -n '1,8p'

The output should show a candidate version from download.docker.com. If APT says the Bullseye repository has no Release file, do not substitute an Ubuntu URL; see the first troubleshooting entry and upgrade the VPS.

Step 4: Install and test Docker Engine

Installing the Compose plugin now gives you the docker compose command for future application stacks managed from Portainer.

sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl enable --now docker
sudo systemctl is-active docker
sudo systemctl is-enabled docker
sudo docker version --format 'Client {{.Client.Version}} / Server {{.Server.Version}}'
sudo docker compose version

Expected output has an active, enabled service; version numbers vary as Docker publishes updates:

active
enabled
Client <version> / Server <version>
Docker Compose version v2.x.y

Run Docker’s disposable test image. It checks the daemon, registry access, and container runtime, then removes the stopped test container:

sudo docker run --rm hello-world

The final lines should include Hello from Docker! and Your installation appears to be working correctly.

Step 5: Deploy Portainer CE with private HTTPS

The named volume keeps Portainer’s users, settings, and environment records outside the container, while the loopback binding prevents direct internet access to the dashboard.

Create the volume and start Portainer’s long-term-support image:

sudo docker volume create portainer_data
sudo docker run -d \
  --name portainer \
  --restart=always \
  --publish 127.0.0.1:9443:9443 \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume portainer_data:/data \
  portainer/portainer-ce:lts

Docker prints a container ID. Confirm that the service is running and published only on loopback:

sudo docker ps --filter name=portainer --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}'
NAMES      IMAGE                       STATUS      PORTS
portainer  portainer/portainer-ce:lts Up ...       127.0.0.1:9443->9443/tcp

Portainer’s official Docker installation guide uses port 9443 for HTTPS and the Unix socket for a local Docker environment. Port 8000 is for optional Edge Agent tunnel features, so it is intentionally not published here. Because 9443 is bound to 127.0.0.1, do not add a public UFW rule for it; keep your existing SSH rule in place.

Step 6: Open the dashboard through SSH

An SSH local forward carries your browser’s connection to the private listener without exposing Portainer in the VPS firewall.

Run this command on your own computer, not in the VPS shell, and leave the terminal open:

ssh -N -L 9443:127.0.0.1:9443 YOUR_SSH_USER@SERVER_IP

Replace YOUR_SSH_USER with the VPS login name and SERVER_IP with the public VPS address. Browse to https://127.0.0.1:9443 on your computer. A certificate warning is expected because the first Portainer container uses a self-signed certificate; continue only if the address is exactly 127.0.0.1.

Create the first administrator promptly, using a unique password of at least 12 characters, then choose the automatically detected local Docker environment. Portainer protects an unconfigured installation by stopping its listener if initial setup is not completed within the startup window.

If local port 9443 is busy, change only the workstation side of the tunnel:

ssh -N -L 19443:127.0.0.1:9443 YOUR_SSH_USER@SERVER_IP

Then open https://127.0.0.1:19443; the VPS-side Portainer port remains 9443.

Verify Docker and Portainer

Run these checks on the VPS to prove that Docker starts at boot, Portainer will restart automatically, the listener is private, and HTTPS answers locally:

sudo systemctl is-active docker
sudo systemctl is-enabled docker
sudo docker inspect --format '{{.HostConfig.RestartPolicy.Name}}' portainer
sudo ss -lntp | grep '127.0.0.1:9443'
curl --insecure --silent --show-error --output /dev/null --write-out '%{http_code}\n' https://127.0.0.1:9443

Expected results include:

active
enabled
always
LISTEN ... 127.0.0.1:9443 ...
200

Refresh the tunneled browser page. You should see Portainer’s login page or dashboard, and the local Docker environment should appear after the first-time wizard completes.

Troubleshooting

does not have a Release file for Bullseye

Docker’s current Debian documentation lists newer Debian releases, and an older Bullseye mirror can disappear as the release ages. Do not point APT at linux/ubuntu or mix Debian releases. Upgrade the VPS to Debian 12 or 13, then follow the matching Docker instructions and use Portainer’s same container command.

permission denied while trying to connect to the Docker daemon socket

The Docker socket is root-owned, which is why this guide uses sudo. Continue using sudo, or grant access to one trusted account and reconnect before testing:

sudo usermod -aG docker YOUR_SSH_USER

Membership in the docker group is effectively root-level access to the host. Do not add ordinary application users to it.

https://SERVER_IP:9443 does not load

That URL bypasses the design of this guide: Portainer listens on 127.0.0.1, not the public interface. Start the SSH tunnel from Step 6 and open https://127.0.0.1:9443 locally. Check the binding with sudo ss -lntp | grep '127.0.0.1:9443'.

Your Portainer instance has timed out for security purposes

Portainer stops a fresh instance when its first administrator is not created in time. Restart it and complete setup immediately:

sudo docker restart portainer

If the container has exited, use sudo docker start portainer, then refresh the tunneled page. Keep the portainer_data volume mounted; deleting it would remove the stored Portainer configuration.

Hardening

  • Keep port 9443 on loopback. If you later publish Portainer through a domain, put it behind a reverse proxy with a trusted certificate, strong authentication, and a narrowly scoped firewall rule.
  • Treat /var/run/docker.sock and the Portainer administrator account as root-equivalent access. Limit SSH and Portainer administration to trusted operators.
  • Back up the portainer_data volume before changing the image tag or rebuilding the container.
  • Use VPSLake’s SSH hardening generator to review SSH settings before relying on the tunnel for administration.

FAQ

Do I need a domain name to use Portainer on Debian 11?

No. The SSH tunnel exposes the private HTTPS listener only to your workstation, so 127.0.0.1 is sufficient. A domain becomes useful only when you deliberately place Portainer behind a public reverse proxy with trusted TLS.

Is port 8000 required for Portainer CE?

No. Port 8000 is an optional tunnel used by Portainer Edge Agent features. A Portainer Server managing Docker on the same host through the Unix socket can leave that port unpublished.

Can I update Portainer without deleting my containers?

Yes. Containers are managed by Docker, while Portainer’s own users and settings live in portainer_data. Preserve that volume and replace only the Portainer container during a planned update.

Should I keep using Debian 11 for a new Docker VPS?

Prefer Debian 12 or 13 for a new deployment because Bullseye is an aging release and newer Docker packages target newer Debian versions. If you already have Debian 11, schedule an upgrade rather than treating this installation as a long-term substitute for a supported release.

Samrat Ghosh
Written by

Samrat Ghosh

Founder & Infrastructure Engineer

Samrat Ghosh is the founder of VPSLake, where he builds and runs the remote desktop and VPS hosting infrastructure the company is built on. He writes hands-on guides about RDP, Windows Server, VPS management and secure remote access - the practical documentation he wishes had…

Previous Article

QuickBooks Desktop Hosting: Run It on Your Own Windows VPS

Next Article

How to Install Docker Portainer on Debian 12

Write a Comment

Leave a Comment

Your email address will not be published. Required fields are marked *

Subscribe to our Newsletter

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨