Deploying Portainer with Docker#
Portainer is a lightweight management UI that allows you to easily manage your Docker environments. This guide walks through deploying Portainer Community Edition as a Docker container.
Prerequisites#
- Docker installed and running (see my Docker installation guide)
- User account with sudo privileges or in the
dockergroup
Create a Volume for Portainer Data#
Portainer stores its data (users, settings, stacks, etc.) in a volume. Create one so your data persists across container restarts:
docker volume create portainer_data
Deploy Portainer Community Edition#
Run the Portainer container with the following command:
docker run -d \
-p 8000:8000 \
-p 9443:9443 \
--name portainer \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:latest
Your portainer data will be stored in the portainer_data volume. follow the in-app or docs guidance after first login.
Deploy Portainer Business edition#
Run the Business edition container with the following command:
docker run -d \
-p 8000:8000 \
-p 9443:9443 \
--name portainer \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
-v portainer_business_data:/data \
portainer/portainer-ee:lts
Your business data will be stored in the portainer_data volume. If your Business license requires activation, follow the in-app or docs guidance after first login.
Breakdown of the flags:
| Flag | Purpose |
|---|---|
-d | Run in detached mode (background) |
-p 8000:8000 | Expose the Edge agent tunnel port |
-p 9443:9443 | Expose the Portainer web UI (HTTPS) |
--restart=always | Automatically restart the container if it stops |
-v /var/run/docker.sock:/var/run/docker.sock | Give Portainer access to the Docker daemon |
-v portainer_data:/data | Persist Portainer data |
Access the Web UI#
Open your browser and navigate to:
https://<your-server-ip>:9443
On first access, you will be prompted to create an admin user and password.
Note: The certificate is self-signed, so your browser will show a security warning. This is expected — click through to continue.
Connect Your Environment#
After logging in, Portainer will ask you to connect an environment. Select “Get Started” to connect to the local Docker instance that Portainer is already running on.
You should now see your containers, images, volumes, and networks in the Portainer dashboard.
Updating Portainer#
To update Portainer to the latest version:
docker stop portainer
docker rm portainer
Portainer Community Edition:
docker pull portainer/portainer-ce:latest
docker run -d \
-p 8000:8000 \
-p 9443:9443 \
--name portainer \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:latest
Portainer Business edition:
docker pull portainer/portainer-ee:lts
docker run -d \
-p 8000:8000 \
-p 9443:9443 \
--name portainer \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
-v portainer_business_data:/data \
portainer/portainer-ee:lts
Your data is safe in the portainer_data volume — only the container image is replaced.
Removing Portainer#
To remove Portainer and its data:
docker stop portainer
docker rm portainer
docker volume rm portainer_data
Conclusion#
Portainer gives you a clean web UI to manage your Docker containers, images, networks, and volumes without needing to remember CLI commands. It’s one of the first things I deploy on any new Docker host.
For more information, visit the official Portainer documentation: