Docker-compose.yml for portainer

Marcel Lamm
1 min readJun 11, 2020

I often happen to search for a simple docker-compose-File that runs portainer on your machine, and I always end up building my own. That’s why I am now helping you out, internet.

For me, I am keeping a directory ~/app/portainer/ on my machine where I can control my portainer instance and update it once in a while.

docker-compose.yml

Here comes the file:

$ ~/app/portainer> cat docker-compose.yml
version: “3”

services:
portainer:
image: portainer/portainer:latest
restart: always
ports:
— “9020:9000”
volumes:
— “/var/run/docker.sock:/var/run/docker.sock”

Note: It will rebind the portainer-port to 9020, so your instance will be reachable under http://localhost:9020.

Start it up

docker-compose up -d

Since restart-always it will be always up, even if you restart your computer.

Once in a while you can give it an update by doing:

docker-compose pull

docker-compose up -d

--

--