Search code examples
docker-composeportainer

How to use more commands together in docker-compose.yml


docker-compose.yml

    version: '3'

services:
  # Your other service definitions here.

  # Portainer
  portainerservice:
    image: portainer/portainer
    volumes:
      - portainer_data:/data
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_password:/tmp/portainer_password
    ports:
      - "9000:9000"


volumes:
  portainer_data:

I need to use two commands, that works separately fine, but how can I use it together?

command:  
      # - -H unix:///var/run/docker.sock
      # - --admin-password-file '/tmp/portainer_password'

Solution

  • I believe you should be able to run them as one line:

    portainerservice:
      image: portainer/portainer
      command: 
          - --admin-password-file '/tmp/portainer_password' -H unix:///var/run/docker.sock
    

    You may have good luck in the documentation as well: https://portainer.readthedocs.io/en/stable/configuration.html#inside-a-file