Self-host guide

How to Self-Host Portainer on a VPS

Install Portainer CE 2.45 LTS on Ubuntu 24.04 with Docker, finish setup with the setup token, keep port 9443 private, back up and update safely.

Portainer Community Edition (CE) is a web interface for Docker, Docker Swarm and Kubernetes. You deploy stacks, read logs, open a console and manage images, volumes and networks from the browser. This guide installs it by hand on Ubuntu 24.04 with Docker, following Portainer's own instructions, and keeps its interface off the open internet.

Prefer one click? Deploy Portainer from the VeloxaHost marketplace and skip the manual steps; this guide is for when you want to run every command yourself.

What you need

  • A VeloxaHost server with the Ubuntu 24.04 LTS image. You get root, over SSH or in the browser terminal on the server's page.
  • Your own IPv4 address, to limit who can reach the interface.
  • No domain and no dedicated IPv4. Portainer serves HTTPS on port 9443 with its own certificate, and a forwarded port of your block on the shared IPv4 address is enough to reach it. IPv6 is not available in US East yet.

Portainer itself is small; the resources go to the containers it manages. A Veloxa 1 (1 vCPU, 2 GB RAM, 50 GB disk) at $8 a month, billed at $0.02 an hour and capped at the monthly price, runs Portainer with a few small containers. Size up for the workloads you plan to run, not for Portainer.

Install Portainer

  1. Install Docker Engine and the Compose plugin from Docker's apt repository, as in Docker's Ubuntu guide. sudo also works as root.

    # Add Docker's official GPG key:
    sudo apt update
    sudo apt install ca-certificates curl
    sudo install -m 0755 -d /etc/apt/keyrings
    sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
    sudo chmod a+r /etc/apt/keyrings/docker.asc
    
    # Add the repository to Apt sources:
    sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
    Types: deb
    URIs: https://download.docker.com/linux/ubuntu
    Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
    Components: stable
    Architectures: $(dpkg --print-architecture)
    Signed-By: /etc/apt/keyrings/docker.asc
    EOF
    
    sudo apt update
    sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    sudo docker run hello-world
    
  2. Create the volume Portainer keeps its database in.

    docker volume create portainer_data
    
  3. Start Portainer Server. This is the command from Portainer's Linux install page with two changes: the image is pinned to 2.45.2, the current LTS release when this was checked, instead of the moving lts tag; and port 8000 is left out. Portainer's docs say 8000 is a tunnel server only needed for Edge agents.

    docker run -d -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:2.45.2
    
  4. Check that it is running.

    docker ps
    
  5. Choose how you reach it.

    Forwarded port. On the server's page, under Ports, forward a port of your block to 9443. Then open https://203.0.113.10:20001, using the shared address and your public port. Attach the firewall in "Secure it" first, so only your address can reach the page.

    SSH tunnel. To expose nothing, publish the port on loopback instead, -p 127.0.0.1:9443:9443 (our change), and tunnel in through the first port of your block, which forwards to SSH:

    ssh -p 20000 -L 9443:127.0.0.1:9443 root@203.0.113.10
    

    Then open https://localhost:9443.

Portainer generates a self-signed certificate for port 9443, so the browser warns on the first visit. Accept it, or load your own certificate (see "Secure it").

First login

The setup page asks for a setup token before it creates the first user. Find it in the container's logs, on the setup_token= line:

docker logs portainer

Your first user is an administrator. The username defaults to admin, and the password must be at least 12 characters long. Finish the setup soon after starting, since anyone who reaches the page with the token could do it first.

The environment wizard then opens and detects the local Docker environment. Choose Get Started. Add more environments later from Environments, Add Environments.

Secure it

Whoever logs in as a Portainer admin controls Docker on the server through /var/run/docker.sock, which is as good as root. Treat the login like a root password.

Firewall. VeloxaHost firewalls are network-level and stateful. Until you attach one, all traffic is allowed (except outbound TCP 25). Go to Firewalls, New Firewall, Add Rule: allow TCP 9443 and TCP 22 only from YOUR.IP/32. Attach it on the server's page. Rules match the port on the server, 9443, not the public port of your block. Ports published by Docker bypass ufw, as Docker's documentation explains, so rely on this firewall rather than ufw. The same applies to every container you publish through Portainer.

Certificate. To use your own certificate instead of the self-signed one, pass Portainer's --sslcert and --sslkey flags. Mount the files into the container and add the flags after the image name:

docker run -d -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data -v /etc/portainer/certs:/certs:ro portainer/portainer-ce:2.45.2 --sslcert /certs/portainer.crt --sslkey /certs/portainer.key

The mount of /etc/portainer/certs is ours; the flags come from Portainer's docs.

Users. Create a separate account for each person under Administration, User-related, Users, rather than sharing the admin login.

Back it up

In Portainer, open Settings and scroll to Back up Portainer. Download backup file saves a tar.gz of Portainer's configuration to your browser; turn on Password protect to encrypt it. Storing backups in S3 or on a schedule is a Business Edition feature. Portainer's docs stress that this backup covers only Portainer's own configuration, not the containers, stacks or volumes you run.

To copy the whole portainer_data volume from the server, use the volume backup pattern from Docker's documentation (stop and start are ours):

docker stop portainer
docker run --rm --volumes-from portainer -v $(pwd):/backup ubuntu tar cvf /backup/portainer-data.tar /data
docker start portainer

Your own containers keep their data in their own volumes; back those up separately.

On VeloxaHost, snapshots are instant and free (5 on Starter, 30 on Pay as you go): server page, Snapshots, name, Create. Restoring overwrites the current state. Automatic snapshots run every hour, 6 hours, 12 hours, daily or weekly, kept for 1, 3, 7, 14 or 30 days. The Backups page creates, downloads and restores server backups (as a new server), on a schedule of every 6 hours, 12 hours, daily or weekly, keeping 1 to 10. A server backup includes every Docker volume on the server.

Update it

Portainer recommends a backup before any update; take a snapshot too. Then remove the container and start the new image with the same volume, as the upgrade page shows, changing the tag to the new release:

docker stop portainer
docker rm portainer
docker pull portainer/portainer-ce:2.45.2
docker run -d -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:2.45.2

Users and settings carry over, because they live in portainer_data. If you run Portainer agents on other servers, keep them on the same version as the server.

Troubleshooting

You forgot the admin password. Stop Portainer and run Portainer's reset helper against the volume. It prints a new password; then start Portainer again.

docker stop portainer
docker pull portainer/helper-reset-password
docker run --rm -v portainer_data:/data portainer/helper-reset-password
docker start portainer

The setup page asks for a token you cannot find. Portainer writes it to its server logs. Run docker logs portainer and look for the setup_token= line.

The page does not load. Check docker ps, the port forward on the server's page, and that the firewall allows 9443 from your current address. Use https://, not http://.

Containers you deploy are not reachable. Each published port needs its own forward from your block and a firewall rule, just like Portainer's own port.

FAQ

What license is Portainer CE under?

Portainer Community Edition is released under the zlib license, a short permissive license. Portainer also sells a Business Edition with extra features, such as scheduled and S3 backups; this guide uses the CE image.

Do I need port 8000?

Only for Edge agents, which connect remote environments back to Portainer through a tunnel. If you manage only this server, leave 8000 out, as this guide does.

Do I need a dedicated IPv4 address?

No. Portainer serves HTTPS on 9443 itself, so a forwarded port of your shared block works. Because the interface controls Docker, limit it to your own address in the firewall, or use the SSH tunnel.

Can Portainer manage containers on other servers?

Yes. Install the Portainer agent on each server and add it under Environments. The agent listens on port 9001 and controls Docker on its server, so forward a port to it and limit that port in the firewall to the address your Portainer server connects from.

Which VeloxaHost size fits Portainer?

A Veloxa 1 (1 vCPU, 2 GB RAM, 50 GB disk) at $8 a month, billed at $0.02 an hour and capped at the monthly price, runs Portainer with a few small containers. For several apps or databases, take a Veloxa 2 (2 vCPU, 4 GB RAM, 80 GB disk) at $15 a month, billed at $0.03 an hour and capped at the monthly price.

Commands and settings checked on 2026-10-19 against the official documentation: docs.portainer.io, github.com, docs.docker.com. Software changes; if a step no longer matches, the vendor's docs win.

Ready to deploy?

Start a free trial, or compare plans to match your team's scale.