Thursday, December 3, 2026
Docker Docker Compose Global Guide Portainer

How to Setup Portainer in Docker with Docker Compose (2026)

image

Managing multiple Docker containers using command-line interface commands can sometimes become overwhelming, especially when scaling your homelab infrastructure. Learning how to how to setup portainer in docker using Docker Compose provides you with a powerful, lightweight, and gorgeous graphical web user interface to oversee all your containerized services in one centralized dashboard.

Portainer removes the complexity of Docker management, allowing both beginners and advanced system administrators to monitor resource usage, check container logs, and manage volumes effortlessly. Learn more in this guide on how to setup portainer in docker.

Table of Contents

1. Why You Need Portainer for Docker Management

Before jumping into how to setup portainer in docker, let’s understand its core benefits. While CLI commands like docker ps or docker logs are great, Portainer gives you instant visual feedback on CPU/memory consumption, container health status, and network configurations.

For official documentation and enterprise licensing options, visit Portainer Official Website.

how to setup portainer in docker

2. What is Portainer?

Portainer is a universal container management tool that lets you easily manage your Docker environments, whether on a local Linux server, a Raspberry Pi, or a cluster of nodes.

3. Step 1: Create Docker Compose File

The cleanest and most robust method for how to setup portainer in docker is by using Docker Compose. Create a dedicated directory and a docker-compose.yml file on your server:

mkdir -p ~/portainer && cd ~/portainer
nano docker-compose.yml

Paste the following configuration into your editor:

version: '3.8'
services:
  portainer:
    image: portainer/portainer-ce:latest
    container_name: portainer
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    ports:
      - "8000:8000"
      - "9443:9443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data

volumes:
  portainer_data:

how to setup portainer in docker

4. Step 2: Run and Access Portainer Web UI

Once your configuration file is saved, run the container stack in the background using Docker Compose:

docker compose up -d

Open your web browser and navigate to your server’s secure URL using port 9443:

https://IP-YOUR-SERVER:9443

During your first visit, create your administrative username and secure password.

5. Step 3: Managing Containers, Volumes, and Networks

Inside the Portainer dashboard, you can view stacks, deploy new containerized applications via Docker Compose templates, inspect live logs, and clean up unused volumes or images with a single click.

6. Conclusion

By mastering how to setup portainer in docker with Docker Compose, you elevate your homelab management to a professional level, saving countless hours of troubleshooting via terminal commands.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *