How to run Portainer CE as a Docker Container using Docker-Compose

How to run Portainer CE as a container using Docker-Compose

Steps:

  • Create a file named compose.yml in the host machine
  • Copy and paste the YAML code in the below line and save the file
version: '3.3'
services:
    portainer-ce:
        image: 'portainer/portainer-ce:latest'
        hostname: portainer
        container_name: portainer
        ports:
            - '8000:8000'
            - '9443:9443'
        volumes:
            - '/var/run/docker.sock:/var/run/docker.sock'
            - 'portainer_data:/data'
        restart: always
  • Run the command to launch the container 
docker compose up -d

Leave a Reply

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