docker(6/0)

Dotnet snippets in justfile

In a recent project there were a few dotnet and Docker snippets that I wrapped into Justfile commands which saved me many headaches. ℹ️ All of these commands are executed in PowerShell. You'll need to add this line to the top of your Justfile for it to use PowerShell as its default interpreter. set windows-powershell := true The first runs the project locally. Nothing special. But it also runs a pre-requisite check function which ensures that another service that my project depends on is running.…

Slim your dotnet dockerfile

After discovering ways to shrink your python dockerfile, I immediately cringed when I saw my baseline dotnet Docker image was about 200MB. How can this be slimmed? Thanks to Brandon Atkinson for the ideas. The base Microsoft runtime image is a startling 190MB, so the first thing we’ll need to do is replace this image with something a bit more slim. Alpine Linux anyone? Let’s look at the minimum setup you’ll need to produce a single executable for an Alpine distro.…

Shrink your python dockerfile

A discovery I made when moving services to Docker containers was the sheer size of a Python container! If you only pull down the latest Python base image and install your dependencies, your image can be upwards of 200Mb. Fortunately, there’s at least one multi-stage Dockerfile build tip that can save you lots of space. Local Package Install The command pip install -r requirements installs your package dependencies under the root python library.…

Make your container accessible to the public network

From what I’ve gathered, these are the steps one must go through to allow a Podman container, such as a traefik proxy, to be accessible from the public network. The challenge lies with the network interface. Podman creates its own cni virtual network interface, but it’s the host’s default network interface that’s usually configured for intranet access. My ufw firewall blocks cross-interface traffic by default, with iptables in the backend to control access.…

Connect peer containers with SSH keys

For the complete, working example, check out the code: connected-containers. Introduction Have you ever had that sinking feeling when you remember that you’ve solved this problem before but you don’t remember where you stashed the solution? And the sense of frustration searching for it, especially when it doesn’t turn up in your usual places? Yea, that’s why I’m writing this down where I can find it. I love the concept of sandboxed environments that can be provisioned and destroyed at whim, which is why I love Docker.…

Write a rust service dockerfile

I began learning Rust in late 2019 because of it’s popularity on StackOverflow. When I realized that the language exposed the internals of programming languages while being easier than my foray into Assembly, I was hooked. I fell in love with Docker using my SPR Consulting Windows machine. I missed the simplicity of Linux and loved how I could destroy the entire environment when I finished working in my Docker container.…