Created
April 7, 2018 10:58
-
-
Save melvinlee/d98ee9432cb8fc26ec62dccae5a4250a to your computer and use it in GitHub Desktop.
Execute bash shell from a running docker container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$docker container ls | |
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
7fe71e1c7bdd redis "docker-entrypoint.s…" 9 seconds ago Up 21 seconds 6379/tcp unruffled_khorana | |
ad8a33ce3b2b nginx "nginx -g 'daemon of…" 14 minutes ago Up 14 minutes 80/tcp vigorous_meninsky | |
$docker exec -it 7fe /bin/bash | |
or | |
$docker exec -it $(docker ps | awk 'FNR == 2 { print $1; }') /bin/bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment