Docker engine Flashcards
How do you run a container in detached mode (in the background)
docker run -d
How do you name a docker container when being run?
docker run –name
How do you specify whether a container should be automatically restarted?
docker run –restart=
options: no, on-failure, always, unless-stopped
How do you publish ports (exposing a containers port by mapping it to the host)?
docker run -p :
How do you automatically remove a container once stopped?
docker run –rm
How do you limit the memory a container uses?
docker run –memory
docker run –memory-reservation
* memory-reservation is a soft limit if memory contention on host
How do you list all running containers?
docker container list
docker ps
How do you list all containers?
docker container list -a
docker ps -a
How do you stop a container?
docker container stop
How do you remove a container?
docker container rm
How do you remove a running container?
docker container rm -f