It's not really clear to me what the workflow is for running a docker image like for example hosted on ECR. Does one need to run a systemd unit to make this work? Or is there a module where you can just input declaratively what should be running and that's it?
NixOS 17.09, but willing to upgrade to 18.03, if needed.
I think you can use config.docker-containers
to specify containers to run
https://github.com/NixOS/nixpkgs/blob/release-17.09/nixos/modules/service-managers/docker.nix
Thank you for answering @FRidh, but I am afraid that your answer is not concrete enough to help me.
@copumpkin The documentation of those options is not usable by me. Can you make it such that it is usable? (Include at the very least an example.)
@coretemp I use rkt + Systemd to run docker containers on NixOS.
As rkt doesn't have it's own process supervision it integrates nicely with NixOS services.
My config looks like this:
virtualisation.rkt = {
enable = true;
};
systemd.services."rkt-arango" = {
description = "ArangoDB (rkt)";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Slice = "machine.slice";
ExecStart = ''\
${pkgs.rkt}/bin/rkt run --insecure-options=image \
--port=8529-tcp:8529 --set-env=ARANGO_ROOT_PASSWORD=secret \
--volume=volume-var-lib-arangodb3,kind=host,source=/var/lib/arango-data,readOnly=false \
--volume=volume-var-lib-arangodb3-apps,kind=host,source=/var/lib/arango-apps,readOnly=false \
docker://arangodb \
'';
KillMode = "mixed";
Restart = "always";
};
};
FYI: docker-containers
was an experimental feature that is removed in 18.03.
Yeah, I merged it by accident, sorry for the confusion 馃槃 someday I'll get enough time to do it properly
Are there any plans for a docker-containers
alternative, or are we expected to roll our own management methodology? I can do that, but if NixOS can handle the logistics for me, what's the point? 馃槃
I'm having a go at a fairly simple version of this in https://github.com/NixOS/nixpkgs/pull/55179
I think we can close this now that docker-containers
is back via #55179. It didn't make it into the 19.03 release but it's usable in nixos-unstable, and ought to show up in the next stable release.
Most helpful comment
@coretemp I use rkt + Systemd to run docker containers on NixOS.
As rkt doesn't have it's own process supervision it integrates nicely with NixOS services.
My config looks like this: