Docker-compose on nixos

Hello,
I am new to nixos and so far I use it as a home daily driver. But I was thinking about taking nixos to work, but my issue is that we use docker-compose on every project I work on.

I read about arion and also how to create docker containers separately. I just dont see a way how to simply run all the “company written docker-compose” files under nix. I simply need that docker-compose binary.

So basically my question is, even if I understand that docker-compose can be replaced by “nix way of doing things” but what if I still wanna use docker-compose on nixos machine? Is it possible? Or do I have to rewrite all of those in nix syntax?

There’s no need to use declarative containers, docker (and compose) should work like on any other distro:

# Pick one
virtualisation.docker.enable = true;
virtualisation.podman.enable = true;

environment.systemPackages = with pkgs; [
  docker-compose  
  ...
];

users.users.<myuser>.extraGroups = [ "docker" ];
1 Like

wow …i m not sure what happened, I would swear that package wasnt found on my package search results yesterday. Thanks for quick response! Nixos is little overwhelming, 3rd day on it

2 Likes

Worth pointing out that adding that group to your user is equivalent to giving it permanent root permissions.

Commonly done, for sure, and some applications that depend on docker give you no choice, but bad practice nonetheless - it’s worth using sudo to invoke docker instead when possible.

2 Likes