Docker Compose has an ability to configure which command to run on cli
container start.
services:
cli:
command: bundle exec thin -p 3000
The command can also be in a list:
services:
cli:
command: ["bundle", "exec", "thin", "-p", "3000"]
This can be useful for automatic services initialization, such as:
services:
cli:
# Using nodemon for live reload
command: ["bash", "-lc", "nodemon index.js"]
Note bash -lc
, not just bash -c
, as login shell initializes docker user environment.