NixOS Containers

From NixOS Wiki
Revision as of 03:06, 27 September 2021 by Nix (talk | contribs) (add more see also references)
Jump to: navigation, search

There's not much to read here. Look at NixOS Manual, the upstream documentation on containers meanwhile.

Declarative docker containers

Example config:

 { config, pkgs, ... }:
   config.virtualisation.oci-containers.containers = {
     hackagecompare = {
       image = "chrissound/hackagecomparestats-webserver:latest";
       ports = [""];
       volumes = [
       cmd = [


I have changed the host's channel and some services are no longer functional


  • Lost data in PostgreSQL database
  • MySQL has changed its path, where it creates the database


If you did not have a system.stateVersion option set inside your declarative container configuration, it will use the default one for the channel. Your data might be safe, if you did nothing meanwhile. Add the missing system.stateVersion to your container, rebuild, and possibly stop/start the container.

See also