What I learned this week 05-05-2025
What I learned this week⌗
Software⌗
Docker relies on Linux kernels, which means that macOS and Windows cannot run Docker natively without some additional steps. Each operating system has its own solution for running Docker. For example, Docker for Mac uses under the hood actually a virtual machine that runs a Linux instance, within which Docker operates.
-
It seems you can get a shell on this VM via:
docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh
-
docker run -d -i -t --name {give it a name} {image}
Finds/Pulls image, runs a container, -i for interactive, -t for a shell, -d for detacheddocker pull {image}
to pull in an image -
docker logs -f {name of container}
to get container logs -
docker pause {name of container}
&&docker unpause {name of container}
pause/unpause container; there’s alsodocker container start
anddocker container stop
-
docker attach --no-stdin {name of container}
attach your terminal’s stdout/stderr to a running container the –no-stdin flag meas we will not attach with std-in, so if you CTRL+C you’re only disconnected form STDOUT -
docker exec {name of container} {command}
Execute commands inside a running container -
docker rm --force looper
stops/removes a running container, basically:docker kill
+docker rm
-
docker search {image}
search images on docker’s servers. Images consist of: registry/organisation/image:tag. But may be as short as ubuntu, then the registry will default to Docker hub, organisation to library and tag to latest
ls containers even after they’ve exited: docker container ls -a
or just docker ps -a
Remove all stopped containers with docker container prune
and for images: docker rmi -f $(docker images -aq)
Flags: -i (interactive), -t (tty) and -d and What is TTY
A dockerfile contains the build instructions for an image
Quite a few popular images are so-called multi platform images which means that one image contains variations for different architectures, one example is Ubuntu.