Docker: Ubuntu Hello World
In our case we just use the shell command echo to print "hello world" to the screen.
FROM ubuntu:23.04 CMD echo hello world
$ docker build -t mydocker .
$ docker run --rm mydocker hello world
docker run --rm mydocker echo Other text Other text
docker run --rm mydocker pwd /
If we try to run it in interactive mode by supplying the -it flags, we'll find out that Docker still runs or CMD and exits. In order to really get into the interactive shell of this container we need to override the default CMD by a call to bash.
docker run -it --rm mydocker bash