Docker sucks for booting up new projects in Linux

Docker development on Linux sucks because of permissions. Containers are built on C Groups, which is kernel-level isolation. The UID and GIDs are shared between the host and containers.

Most containers default to using root (UID 0) by default. This means if you mount your host files inside your container during development, any files created by the container process will likely belong to root, and the host user won’t be able to modify or delete them without running sudo.

Within docker-compose.yml, you can set the UID and GID of the user. You can also do this However, while it will force the container to use the correct UID/GID, it won’t create that user’s home directory. Some language runtimes or package managers rely on the current user having a home directory. Even in the languages that don’t require a home directory, there is no built-in way to pass UID & GID into a docker-compose.yml file without tomfoolery in the shell or a .env file. If the home directory is required, a Dockerfile must be created that creates the user and their home directory.

What is the result? There are two options:

  1. You can have an elaborate readme that has commands for the user to copy-and-paste to get everything to work
  2. You can wrap Docker/Docker Compose in a build script.

This sucks. Docker is great once it’s set up, but I have a graveyard of projects that never got off the ground because I got so bogged down in OPs that I gave up.

I have no solutions here. Just complains.

I’m going to try asdf to nope out of Docker for a while, and maybe I can use sqlite instead of Postgres to avoid the DB. Here’s to hoping this gets me unblocked on my current projects.

Leave a comment