Yes, sometimes you need to include -it even you -d
If ENTRYPOINT is bash or sh
docker run -d ubuntu:14.04 will be stopped immediately because bash cannot find any pseudo-terminal to be allocated. You must specify -it so that bash or sh can be assigned to a pseudo-terminal.
docker run -itd ubuntu:14.04
If you want to use nano with any container in the future, you need to specify -it when starting the image. Otherwise, you will get an error. For instance,
docker run --name mongodb -d mongo docker exec -it mongodb bash apt-get update apt-get install nano nano somefile
An error will occur
Error opening terminal: unknown.
source share