Skip to content

Detached and interactive mode: -d, -i and -t

Select an icon to see what it is.

Step 1 of 6

Foreground and -d

Without -d, docker run attaches your terminal to the container's output and waits for it to exit. With -d the create request does not ask for any attachment, dockerd starts the container, and the CLI prints the container Id and returns. The container keeps running in the background.

$ docker run -d --name sleeper alpine sleep 1000
PrevNext

POST /v1.45/containers/create?name=sleeper

{
"Image": "alpine"
"Cmd": [
"sleep"
"1000"
]
"AttachStdin": false
"AttachStdout": false
"AttachStderr": false
"Tty": false
}