Docker - Containers
'run' always starts a new container from image. 'start' will start an existing container that as previously been stopped.
'docker container run' vs. 'docker container start'
Container
A runtime instance of an image--what the image becomes in memory when executed (that is, an image with state, or a user process).
docker container run <imageName>
Command used to run a Docker container based on an image.
ctrl-c (^C)
ShortCut/HotKeys in terminal. Sends a stop signal to the process when running in foreground. (MacOs) Exit the process in the foreground but leave it running in the background. (Windows)
docker container start -ai <container> [args]
Terminal Command. Combination command used to start one or more stopped containers and: - to attach STDOUT/STDERR - to attach containers STDIN
docker top <containerName>
Terminal Command. List running processes in a specific container.
docker container run -it <image> [args]
Terminal command. Combination of commands, used to run a new container and simulate a real terminal (pseudo-tty) interactively (keep STDIN open) with the new container.
docker container ls
Terminal command. List running containers.
docker container rm
Terminal command. Remove (delete) one or more containers.
docker container exec
Terminal command. Run additional process in a running container.
docker container inspect
Terminal command. Show config details (metadata) of a container.
docker container top
Terminal command. Show list of processes in a container.
docker container logs <containerName>
Terminal command. Show logs for a specific container.
docker container stats
Terminal command. Show performance stats for all containers.
Volumes, Bind Mounts, and tmpfs Mounts
Three options for containers to store files in the host machine, so that the files are persisted even after the container stops: