Comments (3)
See #40
from arion.
There's multiple ways one might make use of NixOS configuration to create a docker image. You can run your service as a NixOS service and enable nixos.useSystemd
to set the docker command to systemd. That's the most predictable way to use NixOS. Alternatively you can wire up service.command
or image.command
like this for example.
If you're not using NixOS by calling its init systemd, there's always a chance that you need something that's normally taken care of by NixOS, like installing certain packages or background services (such as cleaning tmp, reaping zombies etc etc).
So it really depends on your use case. I currently recommend nixos.useSystemd
for most cases but if you need to deploy lightweight images, you'll have to use the image
options to do some things manually instead. Proper images are a recent addition to Arion, so your mileage may vary with that feature.
from arion.
Alright, thanks!
If someone runs into a similar issue, here's a working example:
{ pkgs, ... }:
{
docker-compose.services = {
webserver = { config, pkgs, ... }: {
nixos.configuration = {config, pkgs, ...}: {
boot.isContainer = true;
environment.systemPackages = with pkgs; [
# will be evaluated if service.command isn't set
tree
];
system.build.someEntryFun = pkgs.writeScript "someEntryFun" ''
#!${pkgs.bash}/bin/bash
${pkgs.cowsay}/bin/cowsay "dependencies in this script are fetched automatically"
'';
};
nixos.useSystemd = true;
service = {
command = [ config.nixos.build.someEntryFun ];
useHostStore = true;
};
};
};
}
if nixos.command
is commented out calling docker exec -it <some-hash> tree
will be possible (working since #40).
from arion.
Related Issues (20)
- Dockerfile option is not exposed
- how to 'Improve performance by skipping container image creation'? HOT 2
- services.<name>.service.build.context doesn't work
- Updating/pulling containers on NixOS module deployment. HOT 3
- Allow array of strings to be passed to `entrypoint` HOT 1
- You're using a version of Nixpkgs that doesn't support the includeStorePaths parameter in d HOT 1
- Declarative configuration of supporting operations (using OCI hooks) HOT 2
- Reduce number of layers in built image HOT 1
- How to specify `stdin_open` HOT 1
- [Feat] healthcheck.test is also allowed to be a string
- Infinite recursion when importing from arionPath in configuration.nix HOT 2
- Disable DHCP in NixOS-based containers
- Question: how to get/change input image ( HOT 1
- `arion up` fails with strange error HOT 3
- fails to update on NixOS 23.11 due to nix-store version HOT 3
- shell completions
- ERROR: runtime error: index out of range [0] with length 0 HOT 6
- Arion tries to start a service before podman is up HOT 2
- nix2container integration HOT 1
- Allow setting log namespaces for systemd services generated by Arion on NixOS
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arion.