Skip to content

Instantly share code, notes, and snippets.

@sephraim
Last active October 29, 2022 20:14
Show Gist options
  • Save sephraim/ee6e7c5b31baac879fd8d7de55e7e806 to your computer and use it in GitHub Desktop.
Save sephraim/ee6e7c5b31baac879fd8d7de55e7e806 to your computer and use it in GitHub Desktop.
[Quickly run command inside Docker container] Create a temporary container from your docker-compose.yml setup and run a command in it. #docker
# Example 1
docker compose run --entrypoint 'bash -c' --rm web 'bundle exec rails {db:create,db:migrate}'
# Example 2
docker compose run --no-deps --rm web bundle install && docker compose build
# Example 3
docker compose run --no-deps --rm -e GEM_HOME=/home/ruby/gems <SERVICE_NAME> bundle install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment