Skip to content

Instantly share code, notes, and snippets.

@imedadel
Last active May 9, 2020 13:37
Show Gist options
  • Save imedadel/2b8f68577eb60667e2ca45cef2bbe82f to your computer and use it in GitHub Desktop.
Save imedadel/2b8f68577eb60667e2ca45cef2bbe82f to your computer and use it in GitHub Desktop.
How to run a shell command inside a running Docker container
  1. Get the container's name (this is different from tag or id)
docker ps
  1. Run the command
docker exec -it NAME_OF_CONTAINER sh
  1. ???
  2. Profit

Bonus: To get the content of a file in shell, use cat NAME_OF_YOUR_FILE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment