Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: mount any '/nix/store' from host machine #73

Open
nokome opened this issue Jan 2, 2019 · 2 comments
Open

feature: mount any '/nix/store' from host machine #73

nokome opened this issue Jan 2, 2019 · 2 comments
Assignees

Comments

@nokome
Copy link
Member

nokome commented Jan 2, 2019

Currently, when executing a Nix based docker container we mount a Nix store volume: https://github.com/stencila/dockter/blob/e8563580a1104f58e9d29e37bc8e4d6dc2a81db4/src/cli-nix.ts#L65-L68

Instead of looking for, and creating if necessary, a Docker volume with the name nix-store, why not look for, and create if necessary, a /nix/store directory on the host machine? Or maybe fall back to the current approach only if there is no /nix/store directory on the host machine.

@bmpvieira
Copy link
Collaborator

I've thought of it an can still implement this approach, but ended up going for the Docker data volume approach for its benefits:

Volumes have several advantages over bind mounts:

  • Volumes are easier to back up or migrate than bind mounts.
  • You can manage volumes using Docker CLI commands or the Docker API.
  • Volumes work on both Linux and Windows containers.
  • Volumes can be more safely shared among multiple containers.
  • Volume drivers let you store volumes on remote hosts or cloud providers, to encrypt the contents of volumes, or to add other functionality.
  • New volumes can have their content pre-populated by a container.

In our particular case, I think the first benefit might be the most important. I can also imagine a scenario where a Mac user might be running Nix on the host (with Mac binaries) and decides to try Dockter and ends up corrupting it's Nix store with Linux binaries (pulled by the Docker guests images).

Also, by default Docker data volumes use the local driver, so if we do docker volume inspect nix-store | grep Mountpoint we can see where the /nix folder is located and access it from outside a container if needed (e.g. to mount or copy it to another remote machine).

@nokome
Copy link
Member Author

nokome commented Jan 3, 2019

Ah right, thanks for the clarification. Let's leave this for now then. I'd like to see how the current approach works out in a Kubernetes cluster using a gcePersistentDisk for the Nix store volume.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants