I was attempting to run a docker image of Ubuntu in the background. So I tried the command below.
sudo docker container run -d --name my-ubuntu-container ubuntu:latest
This command, however, does not start the container in the background. In reality, when you verify using this method, the status changes to "EXITED."
docker container ls -a
However, if I add the "-it" flag to the above command, it works. The container then runs in the background.
sudo docker container run -itd --name my-ubuntu-container ubuntu:latest
Now with docker container ls -a, the status is now "UP" and it is running in the background.
Anyone know why adding the "-it" flag to the preceding command, together with "-d," causes the Ubuntu docker image to run in the background?