36 lines
1.5 KiB
Markdown
36 lines
1.5 KiB
Markdown
|
---
|
||
|
title: Docker and NixOS playing nicely together
|
||
|
date: 2024-12-10
|
||
|
permalink: daily/2024/12/10/docker-nixos
|
||
|
tags:
|
||
|
- software-development
|
||
|
- linux
|
||
|
- docker
|
||
|
- nix
|
||
|
- nixos
|
||
|
cta: ~
|
||
|
snippet: |
|
||
|
My homelab laptop is running a combination of native NixOS services and some running with Docker and Docker Compose.
|
||
|
---
|
||
|
|
||
|
As I've added software to my NixOS homelab server, I've found some things that aren't yet available in the nixpkgs repository.
|
||
|
|
||
|
A common approach seems to be to use Docker and Docker Compose to run things in containers, especially ones that need multiple services like a web server, a database and a cache or proxy.
|
||
|
|
||
|
[I've moved my development projects from Docker to devenv][1], but I still have Docker installed and available.
|
||
|
|
||
|
I knew it was easy to create a container image from a Nix-based setup, but the opposite is also true.
|
||
|
|
||
|
It's very easy to run containers within NixOS.
|
||
|
|
||
|
For example, here's [how I've configured Tube Archivist][0].
|
||
|
|
||
|
This was created using a tool called `compose2nix`, but I've seen simpler examples for other services.
|
||
|
|
||
|
This made it easy to take a Docker Compose file and convert it to a Docker or Podman container.
|
||
|
|
||
|
My preference is to use NixOS services if they exist, but it's great to be able to do this as an alternative when needed.
|
||
|
|
||
|
[0]: https://github.com/opdavies/dotfiles/blob/8cdc6a511dab5a31b1bc0a90bcdcf361043498e7/nix/modules/nixos/features/homelab/tubearchivist-container.nix
|
||
|
[1]: {{site.url}}/daily/2024/12/09/drupal-devenv
|