Support for --volumes-from?

Hello,

for some projects we’re using nix expressions (https://nixos.org) for builds and tests. Works great, but it’s hard to combine with drone. The problem is that there is a /nix directory which has all binaries, and needs to be persistent (so we don’t download half the internet every run).

This works great outside drone:
$ docker create -v /nix --name=nix nixos/nix sh
$ docker run --rm --volumes-from=nix -ti nixos/nix sh

If I do that docker create once on the drone agent machine I’m good, but I can’t specify the --volumnes-from in the drone.yml file. Or can I?

Thanks!

have you considered using a plugin to cache the nix binaries?
http://plugins.drone.io/drillster/drone-volume-cache/

or mounting a volume to the host machine?
http://docs.drone.io/docker-volumes/

or you can create a named docker volume and mount into your container. This approach is considered a replacement for volumes_from which has been deprecated in docker compose (fyi)

docker volume create nix

and then in your yaml

pipeline:
  build:
    image: ...
    commands:
      - ...
    volumes:
      - nix:/nix

The problem is that I need the initial content from /nix, to extend it. The nix binaries itself are on it, for exmple… :slight_smile:

I did not know about the named volumes. If I make one of those and copy /nix from a clean container over it might just work. Thanks for the idea!

once:

docker volume create nix
docker run --rm -v nix:/newnix nixos/nix cp -a /nix/store /nix/var /newnix

and then add the volume nix:/nix to all .drone.ymls works great. Thanks again!