HelloGriffin
HelloGriffin

Reputation: 101

Configuring portainer(-ce) from docker-compose.yml

My docker-compose.yml:

version: "3"
services:
    [...]
    portainer:
        image: portainer/portainer-ce
        ports:
            - "10280:9000"
        volumes:
            - "/var/run/docker.sock:/var/run/docker.sock"
            - "./portainer:/data"
        restart: unless-stopped

        command: --admin-password $$2b$$05$$XJA5Fr6FGLsptH8mb2/L2uwH2mXGDJkfbTUkpuFEnSkpWY9D2EKCO
    [...]

(the "[...]" just is for other services which aren't related to the problem)

I configured the admin password with command: --admin-password [bcryptHash] but how do I configure it to use the local / "volumed" docker instance / socket from docker-compose and not from the web interface?

Upvotes: 0

Views: 7360

Answers (2)

Ben Keene
Ben Keene

Reputation: 459

I found a reference to this call for the -H flag here: https://docs.portainer.io/v/ce-2.6/advanced/reverse-proxy/traefik

This contains a full docker-compose file example that sets up a reverse proxy for portainer using traefik. The relevant section is:

version: "3.3"
  services:
  portainer:
    image: portainer/portainer-ce:2.6.3
    command: -H unix:///var/run/docker.sock
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data

volumes:
  portainer_data:

From the official docker documentation site, there is a link to the awesome-compose repo that also has a docker-compose file example for portainer.

So from this document, it would appear that both the volume map for the socket and the command line flag are required.

Upvotes: 1

user14797174
user14797174

Reputation:

Try using this command

command: -H unix:///var/run/docker.sock

Upvotes: 2

Related Questions