Docker
/Beginner
docker start / stop
Definition
CLI commands used to manage the execution state of an existing container without destroying or recreating it.
Explain Like I'm New
The power button on a TV. `docker stop` turns the TV off (but the TV is still in your living room). `docker start` turns the TV back on.
Real World Example
You are running a massive database container locally. When you are done working for the day, you type `docker stop mydb` to save battery power on your laptop. The next morning, you type `docker start mydb` and pick up exactly where you left off.
Common Use Cases
- •Daily workflow
- •Conserving system resources
Crucial Command Flags
| Flag / Option | Description |
|---|---|
| -t / --time (stop) | Seconds to wait for stop before forcefully killing it. |
| -a / --attach (start) | Attach STDOUT/STDERR and forward signals. |
Interview Questions
basic
- If you `docker stop` a container, do you lose the data inside its database?
intermediate
- What is the difference between `docker stop` and `docker kill`?