January 06, 2021

docker run bash

We can run an interactive bash session in docker containers.

docker exec -it cde bash

where cde is the first 3 digits of your docker container

If you have an image but not a container, you can run this for an efficiency boost.

docker run -it ubuntu bash

Interactive and tty

-it actually stands for interactive (-i / --interactive) and tty (-t / --tty)

  • Interactive - like a shell
  • Tty - allocates a pseudo-tty.

References

docker run reference

Read More: