Skip to content
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

Closed
coretemp opened this issue Mar 21, 2018 · 8 comments
Closed

Declaratively running a docker image #37553

coretemp opened this issue Mar 21, 2018 · 8 comments

Comments

@coretemp
Copy link
Contributor

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
Copy link
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
Copy link
Contributor Author

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
Copy link
Member

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
Copy link
Member

davidak commented Mar 25, 2018

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

@copumpkin
Copy link
Member

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

@liamdawson
Copy link
Contributor

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? 😄

@benley
Copy link
Member

benley commented Feb 4, 2019

I'm having a go at a fairly simple version of this in #55179

@benley
Copy link
Member

benley commented May 13, 2019

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.

@benley benley closed this as completed May 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants