Bootstrap FreeKB - Docker - Get an interactive shell into a container using the docker run -it or --interactive and -t or --tty commands
Docker - Get an interactive shell into a container using the docker run -it or --interactive and -t or --tty commands

Updated:   |  Docker articles

When creating a container using the docker run command, the -it or --interactive and -t or --tty flags can be used to establish an interactive shell into the container. In this example, a container is created using the foo:latest image, and the bash shell will be used. Notice in this example that after issuing the docker run command with the --interactive option, a prompt appears to issues commands within the container.

[john.doe@docker ~]# docker run --interactive --tty foo:latest /bin/bash
john.doe@f085285ed20c:/#

 

Or, you could the /bin/bash command building the image from a Dockerfile.

CMD ["/bin/bash"]

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 660664 in the box below so that we can be sure you are a human.