New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declaratively running a docker image #37553

Open
coretemp opened this Issue Mar 21, 2018 · 5 comments

Comments

Projects
None yet
5 participants
@coretemp
Contributor

coretemp commented Mar 21, 2018

Issue description

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?

Technical details

NixOS 17.09, but willing to upgrade to 18.03, if needed.

@FRidh

This comment has been minimized.

Member

FRidh commented Mar 22, 2018

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

@coretemp

This comment has been minimized.

Contributor

coretemp commented Mar 22, 2018

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.)

@bachp

This comment has been minimized.

Contributor

bachp commented Mar 25, 2018

@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";
    };
};
@davidak

This comment has been minimized.

Contributor

davidak commented Mar 25, 2018

FYI: docker-containers was an experimental feature that is removed in 18.03.

@copumpkin

This comment has been minimized.

Member

copumpkin commented Mar 25, 2018

Yeah, I merged it by accident, sorry for the confusion 😄 someday I'll get enough time to do it properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment