{"id":1101,"date":"2026-11-16T18:00:00","date_gmt":"2026-11-16T18:00:00","guid":{"rendered":"https:\/\/vpslake.com\/blog\/?p=1101"},"modified":"2026-11-16T18:00:00","modified_gmt":"2026-11-16T18:00:00","slug":"install-docker-portainer-ubuntu-24-04","status":"publish","type":"post","link":"https:\/\/vpslake.com\/blog\/2026\/11\/16\/install-docker-portainer-ubuntu-24-04\/","title":{"rendered":"How to Install Docker Portainer on Ubuntu 24.04"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Install Docker Portainer on Ubuntu 24.04 and finish with a working Docker Engine plus a persistent Portainer CE dashboard in about ten minutes. The dashboard stays on the VPS itself, while an SSH tunnel lets you open it securely from your workstation. You will use Ubuntu&#8217;s Noble package metadata and Docker&#8217;s official repository, not the older <code>apt-key<\/code> method.<\/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 24.04 LTS VPS with at least 2 GB of RAM and 10 GB of free disk space for images, containers, and Portainer data.<\/li>\n\n\n<li>SSH access as <code>root<\/code>, or a regular account with working <code>sudo<\/code> privileges.<\/li>\n\n\n<li>Outbound HTTPS access to <code>download.docker.com<\/code> and Docker Hub.<\/li>\n\n\n<li>An SSH client on your workstation and a browser. This private setup does not need a domain name; you will browse to <code>127.0.0.1<\/code> through a tunnel.<\/li>\n\n\n<li>A <a href=\"https:\/\/vpslake.com\/buy-vps\">VPSLake Linux VPS<\/a> with root access if you need a fresh Ubuntu server for Docker workloads.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The commands below use <code>sudo<\/code>. If you are logged in as <code>root<\/code>, remove <code>sudo<\/code> from the commands. Keep your existing SSH firewall rule in place; this guide does not publish Portainer&#8217;s management port to the internet.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Confirm Ubuntu 24.04 and update the VPS<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Checking the release first prevents APT from receiving a repository for the wrong Ubuntu codename.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>. \/etc\/os-release &amp;&amp; printf 'ID=%s\\nVERSION_ID=%s\\nVERSION_CODENAME=%s\\n' \"$ID\" \"$VERSION_ID\" \"$VERSION_CODENAME\"\nuname -m\nsudo apt-get update\nsudo apt-get full-upgrade -y<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The release should be Noble and the architecture should normally be <code>x86_64<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ID=ubuntu\nVERSION_ID=\"24.04\"\nVERSION_CODENAME=noble\nx86_64<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the first command identifies another release, stop and use instructions for that release. Do not force Noble packages onto a different Ubuntu version.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Remove packages that can conflict with Docker Engine<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Ubuntu may already contain distribution packages with names that overlap Docker&#8217;s official packages, so remove only installed conflicts before adding the new repository.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\\n' docker.io docker-compose docker-compose-v2 docker-doc docker-buildx podman-docker containerd runc 2&gt;\/dev\/null | awk '$1 ~ \/^ii\/ {print $2}' | xargs -r sudo apt-get remove -y<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">No output means none of those packages were present. Removing packages this way does not erase images, containers, or volumes stored under <code>\/var\/lib\/docker\/<\/code>; on an existing host, still identify important workloads before changing their runtime.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Add Docker&#8217;s official Ubuntu repository<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The repository supplies Docker Engine, the CLI, containerd, Buildx, and the Compose plugin as a compatible set. Docker&#8217;s <a href=\"https:\/\/docs.docker.com\/engine\/install\/ubuntu\/\" target=\"_blank\" rel=\"noopener\">Ubuntu installation guide<\/a> now uses a per-repository keyring and a deb822 source file, which avoids the deprecated global <code>apt-key<\/code> store.<\/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: $(. \/etc\/os-release &amp;&amp; echo \"${UBUNTU_CODENAME:-$VERSION_CODENAME}\")\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\">Check that APT can see a candidate for Ubuntu 24.04 before installing anything:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-cache policy docker-ce | sed -n '1,6p'<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>docker-ce:\n  Installed: (none)\n  Candidate: 5:...~ubuntu.24.04~noble<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The exact version changes as Docker publishes updates. The important detail is that the candidate comes from Docker&#8217;s repository and ends in the Noble release.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Install and test Docker Engine<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Installing the Compose plugin at the same time leaves you ready to deploy application stacks from Portainer later.<\/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\">Expected output has an active, enabled service; version values vary with current releases:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>active\nenabled\nClient 29.x.y \/ Server 29.x.y\nDocker Compose version v2.x.y<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run Docker&#8217;s disposable test image to verify the daemon, registry connection, and container runtime:<\/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\">Near the end of the response, <code>Hello from Docker!<\/code> and <code>Your installation appears to be working correctly.<\/code> confirm that Docker ran a container successfully.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Check UFW and keep Portainer private<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Docker-published ports can interact with UFW&#8217;s packet filtering in surprising ways, so the safest single-server layout is to publish Portainer only on the VPS loopback address.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw status verbose\nsudo ss -lnt | sed -n '1,12p'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If UFW is active, its output should retain an allow rule for your SSH service. Do not add a public rule for 9443: the Portainer command in the next step binds that port to <code>127.0.0.1<\/code>, and the SSH tunnel will carry browser traffic to it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 6: Deploy Portainer CE with persistent HTTPS data<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The named volume keeps Portainer&#8217;s users, settings, and environment records when the container is replaced. Portainer&#8217;s <a href=\"https:\/\/docs.portainer.io\/start\/install-ce\/server\/docker\/linux\" target=\"_blank\" rel=\"noopener\">official Docker installation guide<\/a> uses the Docker socket and HTTPS listener shown here; port 8000 is omitted because it is only needed for Edge Agent tunnel features.<\/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. Confirm that Portainer is running and that the host-side listener is private:<\/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 creates a self-signed certificate for its first HTTPS connection. That warning is expected when you connect through the local tunnel; do not publish the container on <code>0.0.0.0<\/code> just to avoid it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 7: Open Portainer through an SSH tunnel<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The tunnel makes the VPS-only listener available at a local address without adding another inbound firewall rule.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Run this on your workstation, not in the VPS shell, and keep 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 the SSH account on the VPS and <code>SERVER_IP<\/code> with its public address. Open <code>https:\/\/127.0.0.1:9443<\/code> in your browser, accept the certificate warning only for that local address, and create a unique administrator password of at least 12 characters. Portainer&#8217;s first account is an administrator, so do not reuse an SSH or billing password.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If port 9443 is already used on your workstation, change only the local side:<\/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 visit <code>https:\/\/127.0.0.1:19443<\/code>. The VPS still listens privately on 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 an automatic restart policy, the listener is loopback-only, and HTTPS 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<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 tab. You should see Portainer&#8217;s setup 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<\/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>E: Package 'docker-ce' has no installation candidate<\/code><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">APT is usually reading the wrong suite, or the source file was not created successfully. Check the release and repository metadata, then rerun Step 3 rather than switching to an Ubuntu mirror for another release:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>. \/etc\/os-release &amp;&amp; printf 'ID=%s\\nVERSION_CODENAME=%s\\n' \"$ID\" \"$VERSION_CODENAME\"\ngrep -E '^(Types|URIs|Suites|Components|Architectures|Signed-By):' \/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 suite should be <code>noble<\/code>, and the policy output should show Docker&#8217;s repository. A different OS release needs its own repository instructions.<\/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 Unix socket is root-owned, which is why the guide uses <code>sudo docker<\/code>. Continue with <code>sudo<\/code>, or grant access to one trusted administrator 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 provides root-equivalent control over the host. Log out completely and reconnect before running <code>docker info<\/code> without <code>sudo<\/code>; do not add application users to this group.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>bind: address already in use<\/code> for port 9443<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Another process already owns the requested host port. Find it before changing the mapping:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ss -lntp | grep ':9443'\nsudo docker ps --format 'table {{.Names}}\\t{{.Ports}}'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the port belongs to an unrelated service, keep it and recreate Portainer with <code>--publish 127.0.0.1:19443:9443<\/code>; then tunnel local port 19443 to the same VPS port and browse to <code>https:\/\/127.0.0.1:19443<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><code>https:\/\/SERVER_IP:9443<\/code> does not load or Portainer timed out<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The public address is not the URL used by this setup. Start the SSH tunnel again and use <code>https:\/\/127.0.0.1:9443<\/code>; if initial setup was not completed promptly, restart the container and finish the wizard:<\/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\">If the container keeps restarting, inspect the last messages with <code>sudo docker logs --tail 80 portainer<\/code>. Keep <code>portainer_data<\/code> mounted so a restart does not discard the dashboard configuration.<\/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 port 9443 on loopback. If you later need team access, use a domain, a reverse proxy with a trusted certificate, strong authentication, and a narrowly scoped UFW policy.<\/li>\n\n\n<li>Treat <code>\/var\/run\/docker.sock<\/code>, membership in the <code>docker<\/code> group, and the Portainer administrator account as root-equivalent access.<\/li>\n\n\n<li>Back up the <code>portainer_data<\/code> volume before changing the image tag or rebuilding the container.<\/li>\n\n\n<li>For a deliberate SSH and UFW baseline, review VPSLake&#8217;s <a href=\"https:\/\/vpslake.com\/ufw-firewall-generator\">UFW firewall generator<\/a> and keep SSH access allowed before applying changes.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Why use Docker&#8217;s repository instead of Ubuntu&#8217;s <code>docker.io<\/code> package?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Ubuntu&#8217;s package and Docker&#8217;s official Engine packages are maintained through different release channels. The official repository provides Docker Engine together with the matching containerd, Buildx, and Compose plugin packages used in this guide.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Do I need a domain name for Portainer on Ubuntu 24.04?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. The SSH tunnel exposes the private HTTPS service only on your workstation, so <code>https:\/\/127.0.0.1:9443<\/code> is sufficient. A domain becomes useful when you intentionally publish Portainer behind a reverse proxy with a trusted certificate.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is Portainer port 8000 used for?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Port 8000 is an optional tunnel for Portainer Edge Agent features. A Portainer Server managing Docker on the same VPS through <code>\/var\/run\/docker.sock<\/code> can leave it unpublished.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How can I update Portainer without losing its settings?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Keep the <code>portainer_data<\/code> volume and replace only the Portainer container during a planned update. Docker containers and images managed by Portainer are separate from that volume, but you should still back up the volume before changing versions.<\/p>\n\n\n\n<script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"Why use Docker's repository instead of Ubuntu's `docker.io` package?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Ubuntu's package and Docker's official Engine packages are maintained through different release channels. The official repository provides Docker Engine together with the matching containerd, Buildx, and Compose plugin packages used in this guide.\"}}, {\"@type\": \"Question\", \"name\": \"Do I need a domain name for Portainer on Ubuntu 24.04?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. The SSH tunnel exposes the private HTTPS service only on your workstation, so `https:\/\/127.0.0.1:9443` is sufficient. A domain becomes useful when you intentionally publish Portainer behind a reverse proxy with a trusted certificate.\"}}, {\"@type\": \"Question\", \"name\": \"What is Portainer port 8000 used for?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Port 8000 is an optional tunnel for Portainer Edge Agent features. A Portainer Server managing Docker on the same VPS through `\/var\/run\/docker.sock` can leave it unpublished.\"}}, {\"@type\": \"Question\", \"name\": \"How can I update Portainer without losing its settings?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Keep the `portainer_data` volume and replace only the Portainer container during a planned update. Docker containers and images managed by Portainer are separate from that volume, but you should still back up the volume before changing versions.\"}}]}<\/script>\n\n","protected":false},"excerpt":{"rendered":"Install Docker Portainer on Ubuntu 24.04 with Docker&#8217;s official APT repository, persistent data, private HTTPS, SSH access, checks, and fixes.","protected":false},"author":1,"featured_media":1102,"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,102],"class_list":["post-1101","post","type-post","status-publish","format-standard","has-post-thumbnail","category-guides","category-vps-hosting","tag-containers","tag-docker","tag-portainer","tag-ubuntu-24-04","cs-entry"],"_links":{"self":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1101","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=1101"}],"version-history":[{"count":1,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1101\/revisions"}],"predecessor-version":[{"id":4068,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/posts\/1101\/revisions\/4068"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/media\/1102"}],"wp:attachment":[{"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/media?parent=1101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/categories?post=1101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vpslake.com\/blog\/wp-json\/wp\/v2\/tags?post=1101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}