Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Container run -d flag

I am running docker run container command in 2 ways

  1. docker container run 4e5021d210f6
    • It shows container exited N seconds ago on running docker container ls -a
  2. docker container run -d 4e5021d210f6
    • It also shows container exited N seconds ago on running docker container ls -a but do get some long string "954f102a3c83f6fb7c83189415448c4bb101ff1afe775f2d9b7b4cd70f4e137e" (I do not know what is this number)

what is the difference between the execution of command 1 and command 2?

like image 378
Harry S Avatar asked Jun 16 '26 02:06

Harry S


1 Answers

-d will run the container in the background. It's the same as adding --detach. What is being printed when you use -d is the container's ID.

https://docs.docker.com/engine/reference/commandline/run/

like image 58
Joshua Schlichting Avatar answered Jun 18 '26 01:06

Joshua Schlichting



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!