NowNotesTwitter

Containers, not docker

I get a shiny new machine. I spend four hours finding the perfect wallpaper. And then, in a moment of weakness, I realise something. Perhaps my $EMPLOYER did not envision this - me browsing through Pinterest - when they decided to bestow all this computing power upon me?

No time to procrastinate. Time to install some software, time to write some code, time to push $COMPANY closer to the cash capped mountain of success.

docker something something 🤔

Here's the position I find myself in: I must get TimescaleDB (Postgres with some makeup on basically) running. But I don't want to waste my time fiddling with configs, and environment variables, and other scary things. Maybe I can run it in a container? Docker something something?

I ran TimescaleDB in a container on my old Linux machine a few days ago. I can repeat the steps for the new machine. Search 'install docker macOS', click on some links, copy some commands, press enter, and I should be good to go.

Hmmm. Easy. Three simple steps:

  1. Install Docker
  2. Start Docker
  3. Run TimescaleDB in Docker

docker and macOS cannot be friends 😞

I type nix-env -iA nixpkgs.docker (not really understanding what is happening) like the cool kids and press enter. Docker is installed. Great. Step 0 done.

Now I type sudo service start docker and press enter. Error? Why? Ughhh.

I take a step back to see what's going on. I want to start Docker. Docker has two parts: docker-client and docker-daemon. Client talks to daemon, so daemon should be running when client is being used. On Linux, sudo service start docker did the job of running the docker-daemon. service is a Linux specific tool (see this) that makes managing dockerd (the docker-daemon) convenient.

looking for friendly daemons 👹

Turns out service and dockerd don't exist for macOS like they do for Linux. So does it mean that I cannot run docker on macOS? Great. Back to step 0.

When I search 'install docker macOS' the first result tells me to install Docker Desktop. Docker Desktop is a way to get dockerd running on a non-linux OS. But I will not let SEOed search results govern me so I decide against using it.

I take a step back. I realise that I'm stuck. I cannot run TimescaleDB because I cannot get Docker working because dockerd is not available for macOS. I realise that there is a point of interjection. I don't have to run Docker, I just want something that can run TimescaleDB in a container.

a containerised world 📦

I learn within the confines of many StackOverflow tabs that Container ≠ Docker. I want to run TimescaleDB in a containerised form. And there are many tools that can help me do it. Podman is one such tool - thanks to the Open Container Initiative standards.

Podman has a different way of doing things internally but it understands the concept of an image just like Docker does. Not just the concept of an image, but podman also supports Docker APIs so I can do alias docker=podman.

I come out of a rabbit hole of containers, VMs, and OCI standards knowing a little more than before and I update my mental models:


    +------------------------+------------------+----------------+
    |                        |                  |                |
    |                        |      Docker      |     Podman     |
    |                        |                  |                |
    +------------------------+------------------+----------------+
    |                        |                  |                |
    |                        |    +--------+    |   +--------+   |
    |                Client  |    | Docker |    |   |        |   |
    |                        |    +---+----+    |   |        |   |
    |                        |        |         |   |        |   |
    |                        |    +---v-----+   |   |        |   |
    |                Engine  |    | Dockerd |   |   | Podman |   |
    |                        |    +---+-----+   |   |        |   |
    |                        |        |         |   |        |   |
    |                        |  +-----v------+  |   |        |   |
    |  Runtime (High Level)  |  | Containerd |  |   |        |   |
    |                        |  +-----+------+  |   +---+----+   |
    |                        |        |         |       |        |
    |                        |     +--v---+     |    +--v---+    |
    |   Runtime (Low Level)  |     | runc |     |    | runc |    |
    |                        |     +--+---+     |    +--+---+    |
    |                        |        |         |       |        |
    |                        |     +--v----+    |    +--v----+   |
    |                Kernel  |     | Linux |    |    | Linux |   |
    |                        |     +-------+    |    +-------+   |
    |                        |                  |                |
    +------------------------+------------------+----------------+    
    

Moral of the story? Docker is just a tool for containerization. When on macOS use Podman.

~

Further reading: