What is your everyday container lifecycle workflow (run, ps, exec, stop, rm)?
Take a moment.
Say your answer out loud or write it down first — retrieval is what makes it stick. Reveal when you're ready.
Short answer
docker run -d -p HOST:CONTAINER image starts detached; docker ps (−a adds stopped) and docker image ls inspect; docker exec -ti <c> sh shells in; docker stop then docker rm (or rm -f) cleans up. Desktop's Containers view mirrors all of this in a GUI.
Detailed explanation
The Get Started hands-on rhythm: docker run -d -p 8080:80 docker/welcome-to-docker prints the full container ID and serves http://localhost:8080 — the frontend of an nginx site. Verify with docker ps (ID, image, command, ports, name); remember plain ps hides stopped containers, -a shows them. Explore via Desktop's Containers → Files tab (browse the isolated filesystem) or CLI with docker exec -ti db psql -U postgres to run a process inside a live container. Stop cooperatively with docker stop <id-or-name> (short prefixes fine), remove with docker rm after stopping or docker rm -f to stop+remove. Housekeeping twins: docker image ls / docker image history for images, docker volume ls for data. Desktop equivalents exist for every step — Search → Pull → Run with container name + host port, Port(s) link to open the site, Actions → Stop/Delete.
Official docs:Docker docs: What is a container?
Example
docker run -d -p 8080:80 docker/welcome-to-docker
docker ps # running: ID, IMAGE, PORTS 0.0.0.0:8080->80/tcp
docker ps -a # + stopped containers
docker exec -ti <id> sh # shell inside a running container
docker stop <id> # short prefix (e.g. a1f) is enough
docker rm <id> # delete; state outside volumes is lostInterview tip
Walk one container cradle-to-grave aloud — run → ps → exec → stop → rm — and drop the -a shows stopped and short-ID facts mid-flow. That signals daily usage.
Common mistakes
- Using
docker psto find stopped containers (need-a). - Trying to
rma running container without stopping or-ffirst.