command / prompt | description |
---|---|
/var/lib/docker | where are docker containers stored |
docker exec -it <container_name> sh | open a shell into a running container (more) |
docker image ls | list all docker images |
docker image rm | removes an image from the host node — alias docker rmi |
docker rmi $(docker images -a -q) | remove all locally installed Docker images |
docker image prune | removes all dangling images (those with tag none). The -a option would also remove images that have no container |
docker ps -a | list all containers, including the stopped ones — alias: docker container ls -(l)a |
docker container prune | remove stopped containers |
docker logs |
container_id can be either the name or the identifier of the container. You can also use -f to follow |
systemctl status docker | check the status of the docker deamon |
pgrep docker | find the PID of the docker deamon |
$ docker build --network host -t iacs-ui.24.cogn:v1 .
docker build --no-cache --progress=plain --network host -t iacs-ui.24.cogn:v1 . 2>&1 | tee docker-build.log
$ docker run -d -p 8090:8000 --env-file=.env --name iacs iacs-ui.24.cogn:v1
$ docker port iacs 8000/tcp -> 0.0.0.0:8080 8000/tcp -> [::]:8080
docker exec -it iacs sh
provenance
The user that is running the docker commands (if he is a non-root user) must be added in the
sudo usermode -aG docker $USER… but only takes effect after a system reboot. In the meantime you can use newgrp docker in the shell you're working (this will result in a new shell with the current user being part of the docker group).
In November 2024 when going through this docker beginners tutorial (also saved here) I encountered this trace:
In the end I had to change the docker build invocation from:
docker build . -t mperdikeas/catnipto:
docker build . --network host -t mperdikeas/catnip
In initially commented on an already existing bug report and then reported my solution here.
The solution was found in this thread which also reports at least one additional approach.
See also this ChatGPT thread of mine.