In Docker, what does the '-d' flag do when running a container?

Prepare for the Docker Foundations Test. Review essential Docker concepts with multiple choice questions, each with hints and explanations. Ace your exam!

The '-d' flag in Docker is used to run a container in detached mode. When a container is started with this flag, it operates in the background, allowing the terminal session to remain free for other commands. This is particularly useful when you want to run services or applications without keeping the terminal open, such as web servers or database instances.

Detached mode allows you to manage the container independently of the terminal from which it was launched. You can interact with the running container later via Docker commands without needing to keep the initial terminal session active. This mode is key for running applications that need to persist beyond the command line session, offering improved usability in multi-container or production environments.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy