Docker

Aus wiki
Wechseln zu: Navigation, Suche

Commands

version -> "docker version"
info -> "docker info"
search the registry for an image / tag -> docker search busybox
pull an image from docker hub -> docker pull busybox:1.24
list aimges on your docker host -> docker images
remove one or severall images -> docker rmi busybox
show the history of an image -> docker history
docker run
docker run -it --rm
docker run -d --name
docker stop
docker rm
docker run -d -p 80:80 --name webserver nginx -> bind ports from a container
One liner to stop / remove all of Docker containers:
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

Remove all exited containers:

docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs sudo docker rm

Docker Build and Run

clone Project or Create Folder with Dockerfile inside -> means Dockerfile must be exist in a folder
cd into this folder and execute "docker build ."
the image is building based on the instructions inside
"docker run imagename" runs this image (-d = deamon, -t = terminal)