Docker Community Forums

Share and learn in the Docker community.

Command: docker run

Hello guys, I am beginner in docker and I have following doubt: when I use the command ‘docker run’ in the following way(without ‘-it’ flag):

docker run image
or
docker run --name container_name image
or
docker run --name container_name image
or
docker run -d -p --name container_name image

every time I use command ‘docker run’ without ‘-it’ flag , when i try to start the container (docker start id/name) he do not start(command: docker start id) I don’t understanding: why?

Thanks in advanced!

-i is flag for “interactive”. If you need to attach to the container’s STDIN, this flag is mandatory.

-t is flag for “tty” (terminal). If you need to allocate a psedo-TTY (needed for many shells and CLI programs to function properly), you must have this flag.

It’s not usual to start containers you are currently running in interactive mode.

Check docker logs for the container to see why your process is exiting if run in --detached mode.