Põhikäsud
docker --version
docker images // show all docker images
docker image ls // same
docker container ls // list all running containers
docker ps // show all running containers
docker ps --all // show all containers
Abi saamiseks
docker --help
docker container --help
docker container ls --help
docker run --help
Alustamine
Näide: Lae alla ja jooksuta ngingx webserveri konteiner
docker run --detach --publish 80:80 --name webserver nginx
Ava brauseris http://localhost
Näide: Peata konteiner
docker container stop webserver
Puhastamine
Docker provides a single command that will clean up any resources — images, containers, volumes, and networks — that are dangling (not associated with a container):
docker system prune
To additionally remove any stopped containers and all unused images (not just dangling images), add the -a
flag to the command:
docker system prune -a
Stop and remove all containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
Remove image by name:
docker rmi <Image>
Remove all images:
docker rmi $(docker images -a -q)
0