Skip to content

Instantly share code, notes, and snippets.

@njsubedi
Created July 26, 2022 11:07
Show Gist options
  • Save njsubedi/c443302c13695efa945b5dd251bae311 to your computer and use it in GitHub Desktop.
Save njsubedi/c443302c13695efa945b5dd251bae311 to your computer and use it in GitHub Desktop.
Enter into the shell of latest run docker container.
#!/bin/sh
LAST_CONTAINER_ID=$(docker ps | head -n 2 | tail -n 1 | awk '{print $1}')
docker exec -it $LAST_CONTAINER_ID /bin/sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment