Issue getting docker container to run at boot

I am trying to run a docker container at startup (using busybox to learn). After boot and login docker ps -a show zero running containers. Below are the relevant pieces from my configuration.nix. My user is in the docker group. The docker service is running (systemctl output below). Manually running the container works. Any tips for where I’ve gone wrong? Ultimately I am trying to run ghcr.io/siderolabs/booter:v0.3.0 with some cmds and extraOptions, I couldn’t get that to work so figured remove it from the equation and start with something simple (e.g. busybox). Thanks for the help.

Other details (updates):

  • after boot when running docker image ls I don’t see busybox. so i’m not sure it’s even trying to run the container.
# configuration.nix

{
  virtualisation.docker = {
    autoPrune.enable = true;
    enable = true;
    enableOnBoot = true;
  };

  virtualisation.oci-containers = {
    backend = "docker";

    containers = {
      busybox = {
        image = "busybox:latest";
        autoStart = true;
        cmd = [ "sh" "-c" "while true; do sleep 3600; done" ];
      };
    };
  };
}
# systemctl output

[nixuser@nixa:~]$ systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/etc/systemd/system/docker.service; enabled; preset: ignored)
    Drop-In: /nix/store/k2wkv5ykxwx5qfws26rv46cpv813q988-system-units/docker.service.d
             └─overrides.conf
     Active: active (running) since Sat 2026-01-17 12:42:43 MST; 4min 53s ago
 Invocation: f8b37fedea3e48e6a2fad3a4b8841647
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 816 (dockerd)
         IP: 0B in, 0B out
         IO: 140.7M read, 1.4M written
      Tasks: 28
     Memory: 185.1M (peak: 210.6M)
        CPU: 1.679s
     CGroup: /system.slice/docker.service
             ├─816 /nix/store/q16qhpa8700wvd7fddhg6zrygb2fm64w-moby-27.5.1/libexec/docker/dockerd --config-file=/nix/store/qfqhlj454xng383mmba2k78d1cjnh1rs-daemon.json
             └─840 containerd --config /var/run/docker/containerd/containerd.toml
# manually running busybox

[nixuser@nixa:~]$ docker run -it --rm busybox sh
/ # whoami
root
/ # exit

[nixuser@nixa:~]$ 

I figured it out. Forgot to copy my config file to /etc/nixos/configuration.nix :man_facepalming:

1 Like