-
-
Save usametov/bc61b59c67ac928df895b20101585f09 to your computer and use it in GitHub Desktop.
Docker 'run' command to start an interactive BaSH session
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
# Assuming an Ubuntu Docker image | |
$ docker run -it <image> /bin/bash | |
# without the /bin/ part | |
docker run -it ubuntu bash | |
# nothing else but bash... | |
docker run -it bash | |
#if image has a defined ENTRYPOINT. For these cases use: | |
docker run -it --entrypoint /bin/bash <image> | |
# save it as a new image like this: | |
$ docker commit <container_id> new_image_name:tag_name(optional) | |
# for the images w/o bash. | |
docker run -it --entrypoint /bin/sh | |
# If you want to interact with an existing container | |
docker exec -it <name> bash | |
# (alpine has sh) | |
docker exec -it <name> sh | |
# also, try entrypoint | |
... | |
"Cmd": [ | |
"src/service.py" | |
], | |
"Entrypoint": [ | |
"python" | |
], | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment