Yes, sometimes, it’s necessary to include -it even you -d
-
When the
ENTRYPOINTisbashorshdocker run -d ubuntu:14.04will immediately stop, causebashcan’t find any pseudo terminal to be allocated. You have to specify-itso thatbashorshcan be allocated to a pseudo terminal.docker run -dit ubuntu:14.04 -
If you want to use
nanoorvimwith any container in the future, you have to specify-itwhen the image starts. Otherwise you’ll get error. For example,docker run --name mongodb -d mongo docker exec -it mongodb bash apt-get update apt-get install nano nano somefileIt will throw an error
Error opening terminal: unknown.