Skip to content

Commit

Permalink
Add docs on using custom Docker image archives
Browse files Browse the repository at this point in the history
via "services.<name>.image.drv"
  • Loading branch information
tomeon committed Jan 28, 2020
1 parent 1debd3d commit 5666e51
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Arion allows to compose containers with different granularity:
* <<NixOS: run only one systemd service>>
* <<NixOS: run full OS>>
* <<Docker image from DockerHub>>
* <<Docker image tar archive>>

== Installation

Expand Down Expand Up @@ -178,6 +179,53 @@ Describe containers using NixOS-style modules. There are a few options:
}
```

==== Docker image tar archive

`examples/custom-image/arion-compose.nix`:

```nix
{ pkgs, ... }:

let
webRoot = "/www";

webserverImage = pkgs.dockerTools.buildLayeredImage {
name = "a-webserver";

config = {
Entrypoint = [
"${pkgs.darkhttpd}/bin/darkhttpd" webRoot
];

Volumes = {
"${webRoot}" = {};
};
};
};
in {
config.services = {

webserver = {
image.drv = webserverImage;
service.command = [ "--port" "8000" ];
service.ports = [
"8000:8000" # host:container
];
service.volumes = [
"${webRoot}:${pkgs.nix.doc}/share/doc/nix/manual"
];
};
};
}
```

Note that `config.services.<service>.image.drv` accepts any derivation providing a
https://docs.docker.com/engine/reference/commandline/image_load/[`docker image load`]able
tar archive; it is not limited to derivations created with
https://nixos.org/nixpkgs/manual/#ssec-pkgs-dockerTools-buildImage[`buildImage`]
or https://nixos.org/nixpkgs/manual/#ssec-pkgs-dockerTools-buildLayeredImage[`buildLayeredImage`]
from https://nixos.org/nixpkgs/manual/#sec-pkgs-dockerTools[`pkgs.dockerTools`].

=== Run

Start containers and watch their logs:
Expand Down

0 comments on commit 5666e51

Please sign in to comment.