Jump to content

Docker: Difference between revisions

→‎Using Nix in containers: - NixOS in containers using Arion
imported>Tsengia
(Add HOW TO for changing the docker daemon's data-root directory)
(→‎Using Nix in containers: - NixOS in containers using Arion)
 
(7 intermediate revisions by 6 users not shown)
Line 24: Line 24:
</syntaxHighlight>
</syntaxHighlight>


If you're still unable to get access to the socket, you might have to re-login.
If you're still unable to get access to the socket, you might have to re-login or reboot.
{{Warning|Beware that the docker group membership is effectively [https://github.com/moby/moby/issues/9976 equivalent to being root]!}}
{{Warning|Beware that the docker group membership is effectively [https://github.com/moby/moby/issues/9976 equivalent to being root]! <br> Consider using rootless mode below.}}


Note: If you use the [[btrfs]] filesystem, you might need to set the storageDriver option:
Note: If you use the [[btrfs]] filesystem, you might need to set the storageDriver option:
Line 114: Line 114:
More examples can be found in the [https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/docker/examples.nix nixpkgs] repo.
More examples can be found in the [https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/docker/examples.nix nixpkgs] repo.


Also check out the excellent article by [http://lethalman.blogspot.de/2016/04/cheap-docker-images-with-nix_15.html lethalman] about building minimal docker images with nix.
Also check out the excellent article by [https://lucabrunox.github.io/2016/04/cheap-docker-images-with-nix_15.html lethalman] about building minimal docker images with nix.


=== Reproducible image dates ===
=== Reproducible image dates ===
Line 148: Line 148:
1x00ks05cz89k3wc460i03iyyjr7wlr28krk7znavfy2qx5a0hfd
1x00ks05cz89k3wc460i03iyyjr7wlr28krk7znavfy2qx5a0hfd
</syntaxHighlight>
</syntaxHighlight>
=== Directly Using Nix in Image Layers ===
Instead of copying Nix packages into Docker image layers, Docker can be configured to directly utilize the <code>nix-store</code> by integrating with [https://github.com/pdtpartners/nix-snapshotter nix-snapshotter].
This will significantly reduce data duplication and the time it takes to pull images.


== Docker Compose with Nix ==
== Docker Compose with Nix ==
Line 185: Line 191:
* [https://hub.docker.com/r/nixos/nix/tags nixos/nix] (official)
* [https://hub.docker.com/r/nixos/nix/tags nixos/nix] (official)
* [https://hub.docker.com/r/nixpkgs/nix nixpkgs/nix] (built from https://github.com/nix-community/docker-nixpkgs)
* [https://hub.docker.com/r/nixpkgs/nix nixpkgs/nix] (built from https://github.com/nix-community/docker-nixpkgs)
NixOS can be run in containers [https://docs.hercules-ci.com/arion/#_nixos_run_full_os using Arion].


= See also =
= See also =
Line 190: Line 197:
[[Workgroup:Container]]
[[Workgroup:Container]]


Alternatively you can use [https://nixos.wiki/wiki/Podman Podman].
Alternatively you can use [[Podman | podman]].


[[Category:Cookbook]]
[[Category:Cookbook]]
[[Category:NixOS]]
[[Category:Software]]
[[Category:nixpkgs]]
[[Category:Server]]
[[Category:incomplete]]
[[Category:Container]]
[[Category:Applications]]
[[Category:Docker]]
5

edits