{"id":1099,"date":"2026-11-16T13:00:00","date_gmt":"2026-11-16T13:00:00","guid":{"rendered":"https:\/\/vpslake.com\/blog\/?p=1099"},"modified":"2026-11-16T13:00:00","modified_gmt":"2026-11-16T13:00:00","slug":"install-docker-portainer-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/vpslake.com\/blog\/2026\/11\/16\/install-docker-portainer-ubuntu-22-04\/","title":{"rendered":"How to Install Docker Portainer on Ubuntu 22.04"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This guide shows you how to install Docker Portainer on Ubuntu 22.04 and finish with a persistent Portainer CE dashboard in about ten minutes. The dashboard stays off the public network and is opened securely through an SSH tunnel.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>A 64-bit Ubuntu 22.04 LTS (Jammy) VPS with at least 2 GB of RAM and 10 GB of free disk space for Docker images and Portainer data.<\/li>\n\n\n<li>Root access or a normal SSH account with <code>sudo<\/code> privileges.<\/li>\n\n\n<li>Outbound HTTPS access to Docker&#8217;s package repository and Docker Hub.<\/li>\n\n\n<li>An SSH client on your own computer. You do not need a domain because this guide uses a private tunnel.<\/li>\n\n\n<li>A <a href=\"https:\/\/vpslake.com\/buy-vps\">VPSLake Linux VPS<\/a> if you need a root-access Ubuntu server for Docker workloads.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The commands assume a sudo-enabled account. If you are logged in as <code>root<\/code>, remove <code>sudo<\/code> from each command. Run the tunnel command later on your own computer, not inside the VPS shell.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Confirm Ubuntu 22.04 and update APT<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Checking the release first prevents Jammy from receiving packages intended for another Ubuntu version.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>. \/etc\/os-release\nprintf 'ID=%s\\nVERSION_ID=%s\\nVERSION_CODENAME=%s\\n' \"$ID\" \"$VERSION_ID\" \"$VERSION_CODENAME\"\nsudo apt-get update\nsudo apt-get upgrade -y<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected output identifies Ubuntu 22.04 and the <code>jammy<\/code> codename; the package counts will vary:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ID=ubuntu\nVERSION_ID=\"22.04\"\nVERSION_CODENAME=jammy<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the release is not Ubuntu 22.04, stop and use the Docker repository instructions for the release actually installed on the VPS.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Add Docker&#8217;s official Jammy repository<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Ubuntu&#8217;s <code>docker.io<\/code> package is maintained separately from Docker Engine. Docker&#8217;s <a href=\"https:\/\/docs.docker.com\/engine\/install\/ubuntu\/\" target=\"_blank\" rel=\"noopener\">official Ubuntu installation guide<\/a> supplies the Engine, containerd, Buildx, and Compose plugin as one compatible package set.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On a fresh VPS, remove unofficial packages if they are present. This does not delete <code>\/var\/lib\/docker<\/code>, but do not remove an existing runtime on a production host until its containers are backed up:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dpkg-query -W -f='${binary:Package} ${db:Status-Abbrev}\\n' docker.io docker-compose docker-compose-v2 docker-doc docker-buildx podman-docker containerd runc 2&gt;\/dev\/null | awk '$2 ~ \/^ii\/ {print $1}' | xargs -r sudo apt-get remove -y<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Install the repository prerequisites, store Docker&#8217;s signing key in APT&#8217;s keyring directory, and register Jammy explicitly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install -y ca-certificates curl\nsudo install -m 0755 -d \/etc\/apt\/keyrings\nsudo curl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg -o \/etc\/apt\/keyrings\/docker.asc\nsudo chmod a+r \/etc\/apt\/keyrings\/docker.asc\nsudo tee \/etc\/apt\/sources.list.d\/docker.sources &gt; \/dev\/null &lt;&lt;EOF\nTypes: deb\nURIs: https:\/\/download.docker.com\/linux\/ubuntu\nSuites: jammy\nComponents: stable\nArchitectures: $(dpkg --print-architecture)\nSigned-By: \/etc\/apt\/keyrings\/docker.asc\nEOF\nsudo apt-get update<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Confirm that APT has a candidate from Docker&#8217;s repository before installing the daemon:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-cache policy docker-ce | sed -n '1,8p'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The output should show a <code>Candidate<\/code> version and a repository line containing <code>download.docker.com<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Install and test Docker Engine<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Installing the Compose plugin at the same time gives Portainer a complete Docker host for future application stacks.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin\nsudo systemctl enable --now docker\nsudo systemctl is-active docker\nsudo systemctl is-enabled docker\nsudo docker version --format 'Client {{.Client.Version}} \/ Server {{.Server.Version}}'\nsudo docker compose version<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The service should be active and enabled, with version numbers that change as Docker releases updates:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>active\nenabled\nClient x.y.z \/ Server x.y.z\nDocker Compose version v2.x.y<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run Docker&#8217;s disposable test image. It checks daemon access, registry connectivity, and the container runtime, then removes the stopped test container:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo docker run --rm hello-world<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The final lines should include <code>Hello from Docker!<\/code> and <code>Your installation appears to be working correctly.<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Deploy Portainer CE on a private listener<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The named volume preserves Portainer&#8217;s users and settings, while the loopback binding prevents the HTTPS dashboard from accepting direct internet connections.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create the data volume and start the current long-term-support image:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo docker volume create portainer_data\nsudo docker run -d \\\n  --name portainer \\\n  --restart=always \\\n  --publish 127.0.0.1:9443:9443 \\\n  --volume \/var\/run\/docker.sock:\/var\/run\/docker.sock \\\n  --volume portainer_data:\/data \\\n  portainer\/portainer-ce:lts<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Docker prints a container ID. Check that Portainer is running and that its host-side port is loopback-only:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo docker ps --filter name=portainer --format 'table {{.Names}}\\t{{.Image}}\\t{{.Status}}\\t{{.Ports}}'<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>NAMES      IMAGE                       STATUS      PORTS\nportainer  portainer\/portainer-ce:lts Up ...       127.0.0.1:9443-&gt;9443\/tcp<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Portainer&#8217;s <a href=\"https:\/\/docs.portainer.io\/start\/install-ce\/server\/docker\/linux\" target=\"_blank\" rel=\"noopener\">Docker installation documentation<\/a> uses 9443 for its HTTPS interface. Port 8000 is only needed for Edge Agent tunnel features, so it is deliberately not published here. Because the service binds to <code>127.0.0.1<\/code>, do not add a public UFW rule for 9443; Docker also warns that publicly published container ports can bypass normal UFW expectations.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Open Portainer with an SSH tunnel<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The SSH forward carries your browser traffic to the private VPS listener without creating an internet-facing management port.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Run this on your own computer and leave the terminal open:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -N -L 9443:127.0.0.1:9443 YOUR_SSH_USER@SERVER_IP<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>YOUR_SSH_USER<\/code> with your VPS login name and <code>SERVER_IP<\/code> with its public address. Open <code>https:\/\/127.0.0.1:9443<\/code> in your browser. Portainer creates a self-signed certificate initially, so a certificate warning is expected when the address is exactly <code>127.0.0.1<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create the first administrator immediately with a unique password, then select the automatically detected local Docker environment. The first account controls the Portainer instance, so do not reuse your VPS or email password.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If port 9443 is already occupied on your computer, change only the local side of the forward:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -N -L 19443:127.0.0.1:9443 YOUR_SSH_USER@SERVER_IP<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then browse to <code>https:\/\/127.0.0.1:19443<\/code>. The Portainer listener on the VPS remains 9443.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Verify Docker and Portainer<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Run these checks on the VPS to prove that Docker starts at boot, Portainer has a restart policy, the dashboard is private, and its HTTPS endpoint answers locally:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl is-active docker\nsudo systemctl is-enabled docker\nsudo docker inspect --format '{{.HostConfig.RestartPolicy.Name}}' portainer\nsudo ss -lntp | grep '127.0.0.1:9443'\ncurl --insecure --silent --show-error --output \/dev\/null --write-out '%{http_code}\\n' https:\/\/127.0.0.1:9443<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected results include:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>active\nenabled\nalways\nLISTEN ... 127.0.0.1:9443 ...\n200<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Refresh the tunneled browser page. You should see Portainer&#8217;s login page or dashboard, and the local Docker environment should be available after the setup wizard completes.<\/p>\n\n\n\n<aside class=\"vl-element vl-cta-banner\" aria-label=\"Run Docker and Portainer\">\n\t<div class=\"vl-cta-banner__content\">\n\t\t<p class=\"vl-cta-banner__eyebrow\">Ubuntu VPS Hosting<\/p>\n\t\t<h3 class=\"vl-cta-banner__title\">Run Docker and Portainer<\/h3>\n\t\t<p class=\"vl-cta-banner__text\">Get a root-access Ubuntu VPS for a private Docker management dashboard.<\/p>\n\t<\/div>\n\t<a class=\"vl-cta-banner__button\" href=\"\/buy-vps\" aria-label=\"View Linux VPS plans\">View Linux VPS plans<\/a>\n<\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><code>docker-ce<\/code> has no installation candidate<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">APT cannot see the Docker repository, usually because the source file has the wrong suite or the key download failed. Check the source and refresh its metadata:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/etc\/apt\/sources.list.d\/docker.sources\nsudo apt-get update\napt-cache policy docker-ce<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The source should say <code>Suites: jammy<\/code> and <code>URIs: https:\/\/download.docker.com\/linux\/ubuntu<\/code>. Do not replace it with a Debian URL or a different Ubuntu codename.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>permission denied while trying to connect to the Docker daemon socket<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The Docker socket is root-owned, which is why every command in this guide uses <code>sudo<\/code>. Keep using <code>sudo<\/code>, or grant one trusted login access and reconnect before testing:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo usermod -aG docker YOUR_SSH_USER<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>docker<\/code> group grants root-equivalent control of the host. Use it only for an account that should be allowed to administer the entire VPS.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>bind: address already in use<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Another process already owns port 9443 on the VPS, or your computer already has a local listener. Locate the VPS-side process first:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ss -lntp | grep ':9443'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the conflict is on your computer, use the <code>19443<\/code> local tunnel shown in Step 5. If the VPS port belongs to another service, stop or reconfigure that service before recreating Portainer with a different loopback port.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>Your Portainer instance has timed out for security purposes<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Portainer closes a new, unconfigured instance when the first administrator is not created promptly. Restart it, reconnect the SSH tunnel, and complete the setup page:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo docker restart portainer<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Keep the <code>portainer_data<\/code> volume attached. Removing it would erase the saved Portainer configuration and users.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Hardening<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>Keep Portainer on loopback. If you later make it public, use a reverse proxy with a trusted certificate, a narrowly scoped firewall rule, and strong authentication.<\/li>\n\n\n<li>Treat the Docker socket and Portainer administrator account as root-level access. Limit SSH to trusted users and back up <code>portainer_data<\/code> before upgrades.<\/li>\n\n\n<li>Use VPSLake&#8217;s <a href=\"https:\/\/vpslake.com\/sshd-hardening-generator\">SSH hardening generator<\/a> to review SSH settings before relying on the tunnel for administration.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Can Portainer manage containers on another VPS?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. Portainer can add remote Docker environments, but that requires a deliberate agent or secured API connection between hosts. This tutorial configures only the local Docker socket, which avoids exposing a Docker API over the network.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Is port 8000 required for a normal Portainer installation?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. Portainer Server uses HTTPS on 9443 for its web interface. Port 8000 supports optional Edge Agent tunnel features and is unnecessary when Portainer manages Docker on the same VPS.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Can I open Portainer directly at <code>https:\/\/SERVER_IP:9443<\/code>?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Not with this setup. The service listens only on the VPS loopback address, so direct public access is intentionally refused; use the SSH tunnel and visit <code>https:\/\/127.0.0.1:9443<\/code> locally.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do I update Portainer without losing its settings?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Keep the <code>portainer_data<\/code> volume, pull the newer <code>portainer\/portainer-ce:lts<\/code> image, and recreate only the container during a maintenance window. Docker containers and images managed by Portainer remain separate from Portainer&#8217;s own database.<\/p>\n\n\n\n<script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"Can Portainer manage containers on another VPS?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Yes. Portainer can add remote Docker environments, but that requires a deliberate agent or secured API connection between hosts. This tutorial configures only the local Docker socket, which avoids exposing a Docker API over the network.\"}}, {\"@type\": \"Question\", \"name\": \"Is port 8000 required for a normal Portainer installation?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. Portainer Server uses HTTPS on 9443 for its web interface. Port 8000 supports optional Edge Agent tunnel features and is unnecessary when Portainer manages Docker on the same VPS.\"}}, {\"@type\": \"Question\", \"name\": \"Can I open Portainer directly at `https:\/\/SERVER_IP:9443`?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Not with this setup. The service listens only on the VPS loopback address, so direct public access is intentionally refused; use the SSH tunnel and visit `https:\/\/127.0.0.1:9443` locally.\"}}, {\"@type\": \"Question\", \"name\": \"How do I update Portainer without losing its settings?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Keep the `portainer_data` volume, pull the newer `portainer\/portainer-ce:lts` image, and recreate only the container during a maintenance window. Docker containers and images managed by Portainer remain separate from Portainer's own database.\"}}]}<\/script>\n\n","protected":false},"excerpt":{"rendered":"Install Docker Portainer on Ubuntu 22.04 with Docker Engine, persistent data, private HTTPS, SSH access, verification, and practical fixes now.","protected":false},"author":1,"featured_media":1100,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_singular_sidebar":"","csco_page_header_type":"","csco_page_load_nextpost":"","footnotes":""},"categories":[5,9],"tags":[119,118,137,101],"class_list":["post-1099","post","type-post","status-publish","format-standard","has-post-thumbnail","category-guides","category-vps-hosting","tag-containers","tag-docker","tag-portainer","tag-ubuntu-22-04","cs-entry"],"_links":{"self":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1099","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/comments?post=1099"}],"version-history":[{"count":1,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1099\/revisions"}],"predecessor-version":[{"id":4063,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1099\/revisions\/4063"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/media\/1100"}],"wp:attachment":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/media?parent=1099"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/categories?post=1099"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/tags?post=1099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}