Running ubuntu docker image in background

0 votes

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?

Apr 29, 2022 in Docker by Abhijeet
• 180 points

edited 5 days ago 11 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP