How to Install Portainer on Ubuntu 24.04
This guide explains how to manually install Portainer CE on an Ubuntu 24.04 LTS server.
Portainer is a web-based interface that allows you to manage Docker containers, images, volumes, networks, and other Docker resources from a browser.
Requirements
- Ubuntu 24.04 LTS or newer
- Root access or a user with
sudoprivileges - Docker installed and working
- Internet access from the server
- Port 9443 available for Portainer
Step 1 - Connect to Your Ubuntu Server
Connect to your VPS using SSH.
ssh username@YOUR_SERVER_IP
Replace username with your Ubuntu username and YOUR_SERVER_IP with the IP address of your server.
For example:
ssh ubuntu@203.0.113.10
Step 2 - Check Your Ubuntu Version
The Portainer playbook requires Ubuntu 24.04 or newer.
lsb_release -a
You should see something similar to:
Description: Ubuntu 24.04.2 LTS
Codename: noble
You can also use:
cat /etc/os-release
Step 3 - Update the Package List
Before installing anything, update Ubuntu's package information.
sudo apt update
This downloads the latest information about available packages from the configured Ubuntu repositories.
Step 4 - Install Portainer Prerequisites
The Portainer playbook installs ca-certificates and curl.
sudo apt install -y ca-certificates curl
These packages provide tools required for secure HTTPS communication and downloading resources.
Step 5 - Check Whether Docker Is Installed
Portainer runs as a Docker container, so Docker must already be installed.
docker --version
You should receive output similar to:
Docker version 29.x.x
Also check Docker Compose:
docker compose version
You should receive output similar to:
Docker Compose version v5.x.x
Step 6 - Make Sure Docker Is Running
Start Docker and configure it to start automatically when the server boots.
sudo systemctl enable --now docker
Check its status:
sudo systemctl status docker
Look for:
Active: active (running)
Press Q to exit the status screen.
Step 7 - Create the Portainer Installation Directory
The Ansible playbook creates /opt/portainer.
sudo mkdir -p /opt/portainer
Set the directory ownership and permissions:
sudo chown root:root /opt/portainer
sudo chmod 755 /opt/portainer
This directory is used as the Portainer installation location.
Step 8 - Create the Portainer Docker Volume
Portainer needs persistent storage so that its configuration and data are not lost if the container is recreated.
Create a Docker volume called portainer_data:
sudo docker volume create portainer_data
Verify that it exists:
sudo docker volume inspect portainer_data
You should receive information about the Docker volume.
portainer_data volume.Step 9 - Download the Portainer CE Docker Image
Download the latest Portainer Community Edition image.
sudo docker pull portainer/portainer-ce:latest
Verify that the image exists:
sudo docker images | grep portainer
You should see an entry similar to:
portainer/portainer-ce latest
Step 10 - Create the Portainer Container
Now create the Portainer container.
Run the following command:
sudo docker run -d \
--name portainer \
--restart=always \
-p 9443:9443 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:latest
What does this command do?
-druns Portainer in the background.--name portainergives the container the nameportainer.--restart=alwaysautomatically starts Portainer after a reboot or Docker restart.-p 9443:9443exposes Portainer's HTTPS interface on port 9443./var/run/docker.sockallows Portainer to communicate with the Docker engine.portainer_data:/datastores Portainer's persistent data.portainer/portainer-ce:latestspecifies the Portainer Community Edition image.
Step 11 - Check That Portainer Is Running
Run:
sudo docker ps --filter name=portainer
You should see something similar to:
CONTAINER ID IMAGE STATUS
xxxxxxxxxxxx portainer/portainer-ce:latest Up ...
The important part is that the status says Up.
Step 12 - Check the Portainer Logs
If you want to make sure Portainer started correctly, check its logs.
sudo docker logs --tail 50 portainer
You can also follow the logs in real time:
sudo docker logs -f portainer
Press Ctrl+C to stop following the logs.
Step 13 - Test Portainer Locally
Test whether Portainer is responding on HTTPS.
curl -k -I https://127.0.0.1:9443
A working installation should return:
HTTP/1.1 200 OK
This confirms that Portainer's HTTPS web server is responding.
Step 14 - Open Port 9443 in the Firewall
If UFW is enabled on your server, allow HTTPS traffic to Portainer.
sudo ufw allow 9443/tcp
Check the firewall:
sudo ufw status
You should see an entry similar to:
9443/tcp ALLOW
Step 15 - Find Your Server IP Address
Run:
hostname -I
Alternatively:
ip addr
Find the public IP address assigned to your VPS.
Step 16 - Open Portainer in Your Browser
Open the following address in your web browser:
https://YOUR_SERVER_IP:9443/
For example:
https://203.0.113.10:9443/
Because Portainer uses HTTPS with its own certificate by default, your browser may display a certificate warning if you are accessing it directly by IP address.
If this is your own server, verify that you are connecting to the correct IP address and continue to the Portainer page.
Step 17 - Create the Portainer Administrator Account
When Portainer is opened for the first time, you will be asked to create the initial administrator account.
- Enter an administrator username.
- Enter a strong password.
- Confirm the password.
- Continue into the Portainer interface.
Step 18 - Verify the Portainer Container
After completing the setup, run:
sudo docker ps --filter name=portainer
You should see Portainer running and port 9443 mapped.
You can also inspect the container:
sudo docker inspect portainer
Useful Portainer Commands
Check Portainer Status
sudo docker ps --filter name=portainer
Stop Portainer
sudo docker stop portainer
Start Portainer
sudo docker start portainer
Restart Portainer
sudo docker restart portainer
View Portainer Logs
sudo docker logs portainer
View the Last 100 Log Lines
sudo docker logs --tail 100 portainer
Check the Portainer Volume
sudo docker volume inspect portainer_data
Updating Portainer
To update Portainer, first download the latest image:
sudo docker pull portainer/portainer-ce:latest
Stop and remove the existing container:
sudo docker stop portainer
sudo docker rm portainer
Then recreate the container using the same persistent volume:
sudo docker run -d \
--name portainer \
--restart=always \
-p 9443:9443 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:latest
Your Portainer configuration remains in the portainer_data volume.
Complete Installation Command Summary
For experienced users, the main manual installation commands are:
sudo apt update
sudo apt install -y ca-certificates curl
docker --version
sudo systemctl enable --now docker
sudo mkdir -p /opt/portainer
sudo chown root:root /opt/portainer
sudo chmod 755 /opt/portainer
sudo docker volume create portainer_data
sudo docker pull portainer/portainer-ce:latest
sudo docker run -d \
--name portainer \
--restart=always \
-p 9443:9443 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:latest
sudo docker ps --filter name=portainer
curl -k -I https://127.0.0.1:9443
Installation Verification Checklist
- Ubuntu 24.04 or newer is installed.
- Docker is installed.
- Docker is running.
- The
portainer_datavolume exists. - The Portainer CE image exists.
- The Portainer container is running.
- Port 9443 is accessible.
curl -k -I https://127.0.0.1:9443returnsHTTP/1.1 200 OK.- You can open
https://YOUR_SERVER_IP:9443/in your browser. - The Portainer administrator account has been created.
Troubleshooting
Portainer Container Is Not Running
Check the container:
sudo docker ps -a --filter name=portainer
Then check the logs:
sudo docker logs --tail 100 portainer
Port 9443 Is Not Accessible
Check whether Portainer is listening:
sudo ss -lntp | grep 9443
Check UFW:
sudo ufw status
If necessary:
sudo ufw allow 9443/tcp
Docker Is Not Running
sudo systemctl status docker
Start Docker:
sudo systemctl start docker
Check Portainer Logs for Errors
sudo docker logs portainer
Conclusion
Portainer CE is now installed as a Docker container on your Ubuntu 24.04 server.
The Portainer web interface is available at:
https://YOUR_SERVER_IP:9443/
The Portainer data is stored persistently in the Docker volume:
portainer_data
This means the Portainer configuration can survive container removal and recreation as long as the persistent volume is retained.

