From 1cb7d05644154bf985ee9786fe05dcc3c09cb24f Mon Sep 17 00:00:00 2001 From: francesco Date: Sun, 20 Jun 2021 23:15:48 +0200 Subject: [PATCH] add some docker-commands --- docs/docker.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/docker.md b/docs/docker.md index 7b99a29..2bd193c 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -1,9 +1,47 @@ # Docker ## Handling Builds +### Building a Docker image +```bash +sudo docker build -t tag/name . +``` +> **_NOTE:_** The `-t`-tag stands for Tag followed by the Tag-Name and the `.` is the location of the Dockerfile. ## Handling Images +### List all images +```bash +sudo docker images +``` + +### Delete all unused Images +```bash +sudo docker image prune -a +``` ## Handlicng Containers +### List all running containers +```bash +sudo docker ps +``` +### List all containers +``` +sudo docker ps -a +``` + +### Delete a running container +``` +sudo docker rm -f +``` +> **_NOTE:_** The `-f`-tag stands for force-command + +### List all Containers with `Exited` Code +```bash +sudo docker ps -q -f status=exited +``` + +### Delete all containers with `Exited` Code +```bash +sudo docker rm $(sudo docker ps -q -f status=exited) +``` ## Handling private registry \ No newline at end of file