Can I pass arguments to docker-compose command configuration option

Does anyone know how I can use the: option command in docker-compose to run my command with arguments? I know that version 2 offers arguments, but this works with docker-engine 1.10.x. I am on docker-engine 1.6.2 and cannot upgrade at the moment.

I want to do something like this in docker-compose:

...
rstudio:
  image: rocker-hadleyverse
  command: -d -p 8787:8787 -e USER=<username> -e PASSWORD=<password> rocker-hadleyverse
  links:
    - db
...
+1
source share
1 answer

Read docker-compose docs , in the docker-compose.yml file it commandrefers to the actual command executed inside the container, not the parameters you pass to docker run. Your example translates to:

rstudio:
  image: rocker-hadleyverse
  ports:
    - "8787:8787"
  environment:
    - USER=foo
    - PASSWORD=bar
  links:
    - db

docker-compose up -d.

+4

Source: https://habr.com/ru/post/1675355/


All Articles