I'm new to Docker, when I run my docker image with -it option, docker container finishes running, echoed "test" as indicated in my docker file and exited with zero. The expected behavior should be that docker keeps open a virtual terminal of the container:
docker run -it test
Here is my Docker file:
FROM centos
CMD echo test
I tried both CMD and ENTRYPOINT, and both shell form and exec form, the behavior is the same. However, if I replace the CMD by RUN in the docker file, the -it option can work normally.