Docker Community Forums

Share and learn in the Docker community.

Requesting some kind of alias/script/macro integration with docker-compose

(Eli7vh) #1

I think it would be useful for docker to have a kind of ‘scripts’ key that you could add into your compose file

scripts: # or "macros"
    rails_console: "run --rm api bin/rails console"
    rspec: run --rm api -c "rspec RAILS_ENV=test"

then you would just type docker-compose rails_console or docker-compose rspec

could possibly even have an m or macro argument docker-compose macro rspec is still better than tying put a long, error prone command.

this would come in useful with certain things like resetting your database environment, seeding, importing all that.

This follows the docker mentality of having “nothing installed” on the operators computer, The current workaround is either bash scripts, aliases, or a make file.

If you switch to a new system, you would need to make sure to copy over all the other stuff too… This would be a nice one-shot solution