Skip to content

Instantly share code, notes, and snippets.

@jimmyadaro
Created May 20, 2021 12:16
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 jimmyadaro/51157e435ca64cd3c7000cc1070e56ec to your computer and use it in GitHub Desktop.
Save jimmyadaro/51157e435ca64cd3c7000cc1070e56ec to your computer and use it in GitHub Desktop.
Execute a Docker container with bash as shell (using an alias)
# I'm using .zshrc but should be valid in any sh or bash shell
alias dexec='(){docker exec -it $1 /bin/bash;}'
# Use it like this:
# dexec <container name or ID>
# dexec my_website
# dexec ea2bdf44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment