wiki:docker-containers
Table of Contents
Docker Containers
Containers are running instances of images, with isolated filesystems, networks, and environment. Start a container with docker run; it boots instantly and includes all dependencies. Containers are ephemeral by default—data and changes disappear when they stop, unless you use volumes.
$ docker run -it ubuntu # run interactively (exit to stop) $ docker run -d --name myapp nginx # run in background $ docker ps # list running containers $ docker ps -a # list all containers, including stopped $ docker stop <container> # stop a container gracefully $ docker rm <container> # delete a stopped container
Containers that exit remain on disk until you delete them. Use docker logs to see output, docker exec to run commands inside a running container, and docker restart to start a stopped one. Each container is isolated—changes inside don't affect other containers or the host.
wiki/docker-containers.md · Last modified: (external edit)
