4 ms·
> the advantage of Docker is that you can slap an image together by doing essentially what you were doing - running a couple of apt install commands, pip instal
by _ibu9 10y ago
> the advantage of Docker is that you can slap an image together by doing essentially what you were doing - running a couple of apt install commands, pip install -r requirements.txt, copy a few files and it's done.
This is exactly what Nix expressions consist of, expect actually reproducible.
> You don't need to learn a new configuration language, or package all your dependencies yourself
Isn't this exactly what Docker and friends require...?
> or try to understand a new filesystem layout when you enter a container.
It wouldn't be new if it was standard as it should be.
- icebraining 10y agoThis is exactly what Nix expressions consist of, expect actually reproducible. Wait, really? You run "apt-get install X Y Z" in a Nix expression? Or are you saying they're equivalent? Because my point is that Docker runs the exact same commands. Isn't this exactly what Docker and friends require...? Sort of, but not really. Dockerfiles are extremely basic, and most of the work is done by shell commands, which developers are know and use. As for packaging all the dependencies, well, yes, but as a big ball of mud. Nix & Guix encourage you to use different packages and connect them. Dockerfiles are literally just dumb container in which you shove everything (using the same commands you already knew). It wouldn't be new if it was standard as it should be. And if my grandmother... well, you know the rest. ================= Don't get me wrong, I'm not praising Docker, on the contrary. I'm just explaining why I think it's more popular than Nix/Guix.
- chriswarbo 10y ago> Wait, really? You run "apt-get install X Y Z" in a Nix expression? It's probably possible, if you're running Nix on a Debian-based distro, assuming permissions and things are set up right. Of course, that probably counts as Nix abuse, the results wouldn't be any nicer than using apt-get as-is, and it may play badly with Nix's caching. As a more realistic example, it's perfectly possible to fetch a bunch of repos and configure/build them using the normal processes for that language, e.g. something like this for a Haskell package: with import <nixpkgs> {}; runCommand "some-haskell-app" { buildInputs = [ ghc cabal-install git ]; } '' echo "Fetching dependencies" 1>&2 git clone "http://some-url" cd cloned-repo cabal update echo "Building" 1>&2 cabal sandbox init cabal configure --prefix=$out cabal build echo "Installing" 1>&2 cabal install ''; If you like opaque, monolithic blobs of bash, then the above seems pretty comparable to Docker. The reason few Nix users would do such a thing isn't that it's not possible, it's just that Nix's language makes it easy to decouple those pieces into composable modules; verify, cache and share intermediate results; selectively override parameters; inspect and debug at a REPL; etc. In fact, it's probably quite straightforward to implement a docker-like system as a bunch of Nix functions, e.g. to get something like: with import <nixpkgs> {}; fauxDocker { baseImage = http://some/huge/docker/blob; # Will be run in a chroot of the above image setup = '' apt-get update apt-get install foo bar ... ''; };
- chriswarbo 10y ago> In fact, it's probably quite straightforward to implement a docker-like system as a bunch of Nix functions Oh, it turns out that already exists. Just came across some tests, which appear to chroot into another OS image and run commands. Complete coincidence :) https://github.com/NixOS/nix/blob/master/release.nix#L202 https://github.com/NixOS/nix/blob/master/release.nix#L202