Last active
March 2, 2023 17:09
-
-
Save cbfn/be2fdaccfaf0d16faae64e0dcd152650 to your computer and use it in GitHub Desktop.
Getting docker container id
This file contains 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
# Don't forget to change <text> with the search term | |
#!/bin/bash | |
DOCKER_CONTAINER_NAME="container name or other text" | |
DOCKER_CONTAINER="$(docker ps | grep $DOCKER_CONTAINER_NAME | awk '{print $1;}')" | |
DOCKER_RUN_CONSOLE="docker exec -it $DOCKER_CONTAINER /bin/bash" | |
ascii_name() { | |
cat <<"EOT" | |
_ _ _ | |
| | | | | | | |
__| | ___ ___ | | __ ___ _ __ ___ ___ _ __ ___ ___ | | ___ | |
/ _` | / _ \ / __|| |/ / / _ \| '__| / __| / _ \ | '_ \ / __| / _ \ | | / _ \ | |
| (_| || (_) || (__ | < | __/| | | (__ | (_) || | | |\__ \| (_) || || __/ | |
\__,_| \___/ \___||_|\_\ \___||_| \___| \___/ |_| |_||___/ \___/ |_| \___| | |
EOT | |
} | |
ascii_name | |
eval $DOCKER_RUN_CONSOLE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment