Skip to content

Instantly share code, notes, and snippets.

@iBobik
Created September 15, 2017 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iBobik/0a579f7d0989c216845934b1bf0a35ca to your computer and use it in GitHub Desktop.
Save iBobik/0a579f7d0989c216845934b1bf0a35ca to your computer and use it in GitHub Desktop.
Useful functions and aliases for Docker
# Open shell to a Docker Compose service container:
# use like: dsh # open shell to 'app' service (container name like project_app_1)
# dsh db # open shell to 'db' service
function dsh() {
DEFAULT_SERVICE=app
docker exec -it $(docker-compose ps -q ${1:-$DEFAULT_SERVICE}) sh
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment