Drone

Mounting volume from host - what am I missing?

I would like to use a folder on the host machine to always store some files (specifically the composer vendor directory to make updates go faster).

kind: pipeline
name: default

steps:
- name: laravel
  image: kristianji/xx
  volumes:
  - name: cache
    path: /var/www/vendor
  commands:
  - ...
  - composer install --no-progress
  - composer dump-autoload -a
  - ...
image_pull_secrets:
- dockerconfigjson

volumes:
  - name: cache
    host: 
      path: /var/drone/cache
  - name: memory
    temp:
      medium: memory

services:
- name: database
  image: mysql:5.7
  ports:
  - 3306
  volumes:
    - name: memory
      path: /var/lib/mysql
  environment:
    MYSQL_DATABASE: ...
- name: redis
  image: redis:4.0.5-alpine
  command: ["redis-server"]
  hostname: redis
  ports:
    - 6379

So I would expect that

  • the folder /var/drone/cache on the host machine will contain all the packages installed inside the virtual machine using composer (as composer installs the files into /var/www/vendor folder, and I mounted that folder to the “cache” volume).

Docker is ran as root.

I followed this guide:
https://docker-runner.docs.drone.io/configuration/volumes/host/

There are no errors, but the folder /var/drone/cache is always empty, and the composer package installation always starts from scratch.

Is there a way to debug this - what am I overlooking?