diff --git a/knowledge base/docker.md b/knowledge base/docker.md index ef8dbec..678eb3e 100644 --- a/knowledge base/docker.md +++ b/knowledge base/docker.md @@ -3,21 +3,50 @@ ## TL;DR ```shell -# run a container -docker run --rm hello-world +# Run containers. +docker run hello-world +docker run -ti --rm alpine cat /etc/apk/repositories +docker run -d --name boinc --network=host --pid=host -v "boinc:/var/lib/boinc" \ + -e BOINC_GUI_RPC_PASSWORD="123" -e BOINC_CMD_LINE_OPTIONS="--allow_remote_gui_rpc" \ + boinc/client -# run a container and gite it a volume and variables -docker run -d --name boinc --net=host --pid=host -v "${HOME}/boinc:/var/lib/boinc" -e BOINC_GUI_RPC_PASSWORD="123" -e BOINC_CMD_LINE_OPTIONS="--allow_remote_gui_rpc" boinc/client - -# show containers status +# Show containers status. docker ps --all -# cleanup -docker system prune +# Cleanup. +docker system prune -a ``` -## Further readings +## Daemon configuration -- [archlinux wiki] +The docker daemon is configured using the `/etc/docker/daemon.json` file: + +```json +{ + "default-runtime": "runc", + "dns": ['8.8.8.8', '1.1.1.1'] +} +``` + +## Containers configuration + +Docker mounts specific system files in all containers to forward its settings: + +```shell +6a95fabde222$ mount +… +/dev/disk/by-uuid/1bb…eb5 on /etc/resolv.conf type btrfs (rw,…) +/dev/disk/by-uuid/1bb…eb5 on /etc/hostname type btrfs (rw,…) +/dev/disk/by-uuid/1bb…eb5 on /etc/hosts type btrfs (rw,…) +… +``` + +Those files come from the volume the docker container is using for its root, and are modified on the container's startup with the information from the CLI, the daemon itself and, when missing, the host. + +## Sources + +- [Archlinux Wiki] +- [Configuring DNS] [archlinux wiki]: https://wiki.archlinux.org/index.php/Docker +[configuring dns]: https://dockerlabs.collabnix.com/intermediate/networking/Configuring_DNS.html