如何在docker-compose.yml中一起使用更多命令

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:

我需要使用两个命令,它们单独使用可以正常工作,但如何同时使用它们?

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

你可以试试这个-

命令:-c 'first_command && second_command2'

我相信您应该能够 运行 将它们作为一行:

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

你也可能在文档中有好运气:https://portainer.readthedocs.io/en/stable/configuration.html#inside-a-file