NixとDocker
#WIP
NixとDockerは目的(の一部)が同じだが、その実現方法が異なるため、
「どこが違うのか」「どっちのほうが優れているのか」が知りたくなる
理解が進んでいないためとりあえず雑に「NixとDocker」でページを切っているmrsekut.icon
Nixの記事を読んでいてDockerに言及があるものをとりあえずぶちこんでいる
理解が進んだらもう少し詳細にページを切りたい
こんな感じの話題がある
Dockerでは再現性が担保されないのでNixの方が良い
DockerとNixでは得意とするところが異なるのでうまい具合に併用しようぜ
DockerとNixの相違点の1つに仮想化するかどうかがある
MacではDockerのパフォーマンスが悪いのでNixを使ったほうがいい
etc.
Arion
https://github.com/hercules-ci/arion
Nixを使って❌Docker Compose v1する
https://docs.hercules-ci.com/arion/
Speedy Development environments with Nix and Docker | Mattia Gheda
Dockerとnix-shellの比較をしている
依存関係に対してできることはだいたい同じだが、localで開発する際に(特にmacでは)Dockerは遅すぎると指摘
併用しようやという結論
DBやNGINXの使用はdockerを使って、
rubyやnodeなどの依存関係の管理にはnixを使う
What Is Nix and Why You Should Use It
DockerやSnapやFlatpakと、Nixの違いについて述べている
DockerなどはFHSに依存しているので(?)再現性がない
よくわかっていないmrsekut.icon
同じDocker Imageからは全く同じ環境が再現されるが、
同じDockerfileからは同じ環境が再現されるとは限らない(しばしば異なる)
Nixはderivationのhashが同じなら同じ結果になる
NixでDockerを使う
https://zero-to-nix.com/start/learn-more#containers
Zero to Nix
pkgs.dockerTools
Nix式からDocker Imageを作るやつ
https://github.com/nix-community/docker-nixpkgs
repo
hocker
https://github.com/awakesecurity/hocker
https://gist.github.com/datakurre/a5d95794ce73c28f6d2f
https://discourse.nixos.org/t/is-there-much-difference-between-using-nix-shell-and-docker-for-local-development/807
https://ghedam.at/15502/speedy-development-environments-with-nix-and-docker
https://discourse.nixos.org/t/is-there-much-difference-between-using-nix-shell-and-docker-for-local-development/807
http://sandervanderburg.blogspot.com/2020/07/on-using-nix-and-docker-as-deployment.html
https://mehmetyavuzyagis.medium.com/nix-or-docker-db1dc667f404
https://blog.container-solutions.com/step-towards-future-configuration-infrastructure-management-nix
https://www.reddit.com/r/NixOS/comments/nh0cc7/why_do_people_compare_nixos_to_docker/
https://discourse.nixos.org/t/is-there-much-difference-between-using-nix-shell-and-docker-for-local-development/807/6
https://twitter.com/watanany/status/1250097446371201024
I sometimes use Docker for throwaway shells, but it’s a hassle to mount volumes in and out of the container, and it can be quite tedious. I also resent the amount of RAM and CPU that Docker uses, and Brew was very slow on my old Mac, so I was looking for some extra speed there too.ref