Date: Fri, 29 Mar 2024 00:56:40 +0000 (UTC) Message-ID: <515733252.65.1711673800133@fa0ec5443aab> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_64_1534171581.1711673800132" ------=_Part_64_1534171581.1711673800132 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Just some basic docker commands:
sudo gr= oupadd docker sudo usermod -aG docker $USER newgrp docker
docker = image ls
Remove all dangling images (e.g. those that are not tagged or referenced= by a container):
docker = image prune
Remove all images not currently in-use by an existing container:
docker = image prune -a
docker = pull <image>
Where <image> is the docker image, e.g. "prom/prometheus".
docker = images |grep -v REPOSITORY|awk '{print $1}'|xargs -L1 docker pull
To output and follow logs of a container use the -f
or
docker = logs -f <container>
To show extra details (such as env variables etc.) use the --detai=
ls
flag:
docker = logs --details <container>
Show running:
docker = container ls
Show all:
docker = container ls --all
docker = <start|stop|restart> <container>
docker = rm <container>
The below will stop and remove (delete) a container
docker = rm -f <container>
docker = port <container>
docker = cp <container>:/file/path/within/container /host/path/target
docker = exec -it <container> /bin/bash
This will delete all stopped containers, all networks not used, all dang= ling images, and all build cache:
docker = system prune