The Docker Run Reference says that running a container with -t
-t : Allocate a pseudo-tty
But only running it with -i
allows the user to interact with the containerized process through the terminal. So I wonder, what is the meaning of "Allocating a pseudo-tty", since even when running without -t
, content written to STDOUT
by the process will be passed to the terminal (The process will have a pipe as stdout instead of a tty) ?
I read this answer which says that you may run docker run -t
to have "Terminal support", such as text coloring etc. Well I already done the following experiment:
// Dockerfile
FROM ubuntu:latest
CMD ["echo", "-e", "u001b[31mHello World"]
And ran this image with no -t
. Since I'm running it from a terminal (docker run
will always run from some terminal won't it?) I can see a red "Hello World". So I still don't understand why running with -t
alone...
question from:
https://stackoverflow.com/questions/65876075/why-run-docker-container-with-t 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…