How distrobox changed my life
Discover how distrobox transformed my life and might do the same for you

Hey! This is my first blog on Hashnode, but not my first blog ever. Previously, I used to write tech blogs on WordPress. Over time, I lost interest in writing there because there was too much happening in tech, and I couldn't keep up due to work. Anyway, let's move past the boring part and get started with my first blog here. By the way, whether you like my content or not, please comment and make sure you leave a like 😉.
Let's get to the nitty gritty of the article.
The inception
I used to be like almost everyone, installing devtools and packages on my local machine back in the day, until I discovered Docker one day. Here's what I found during that time:
Docker can:
Set up your development environment with a single file called the Dockerfile.
Let you use any Linux distro you want without having to install it on bare metal.
Make you focus only on the software you're building, not the environment.
But one Sunday evening, I was bored and wanted to further simplify my development environment setup beyond a Dockerfile.
The elaboration
There I found distrobox, which fascinated me in every single way, I was jumping in joy because of the simplicity it offered, for context, thanks to docker docs, this was the compose file, which I used to setup a nodejs dev environment:
services:
server:
build:
context: .
target: dev
ports:
- 3000:3000
- 9229:9229
environment:
NODE_ENV: production
POSTGRES_HOST: db
POSTGRES_USER: postgres
POSTGRES_PASSWORD_FILE: /run/secrets/db-password
POSTGRES_DB: example
depends_on:
db:
condition: service_healthy
secrets:
- db-password
volumes:
- ./src:/usr/src/app/src
db:
image: postgres
restart: always
user: postgres
secrets:
- db-password
volumes:
- db-data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=example
- POSTGRES_PASSWORD_FILE=/run/secrets/db-password
expose:
- 5432
healthcheck:
test: [ "CMD", "pg_isready" ]
interval: 10s
timeout: 5s
retries: 5
volumes:
db-data:
secrets:
db-password:
file: db/password.txt
By the way, if you want to use this, please change the POSTGRES_DB name and other example values provided. Moving on, this was the distrobox file after I switched to distrobox. Once again, thanks to Microsoft devcontainers images for making this beautiful machine learning box image. I use the same box for all my development activities, ranging from developing Java APIs to creating ML apps.
[mlbox]
image=mcr.microsoft.com/devcontainers/anaconda:latest
additional_packages="nano git btop"
init_hooks="pip3 install huggingface_hub tokenizers transformers accelerate datasets wandb peft bitsandbytes fastcore fastprogress watermark torchmetrics deepspeed"
nvidia=true
pull=true
root=false
replace=false
home=/home/$USER/mlbox-home
As you can see from the above file, I have all the necessary packages for machine learning. The rest of the packages are installed using brew. Even my code editor, Vscodium, is installed on the same box. This not only separates concerns but also contributes to the immutability of my base operating system, which is Arch Linux (I use Arch btw).
The Conclusion
Distrobox changed the way I looked at Docker containers and further simplified my life by isolating my development environment from my local packages.
I will publish more blogs detailing my complete dev environment setup in parts over the upcoming days. Until then, stay tuned and happy coding! 🖥️




