How to Mount a Device

Drone supports mounting a host machine device into a Pipeline container. This option is only available to Trusted repositories, which requires a system administrator to enable the trusted flag, which can be found in your repository settings. The yaml configuration syntax is identical to mounting a volume:

kind: pipeline
name: default

steps:
- name: test
  image: alpine:3.8
  privileged: true
  commands:
  - ls /tmp/dev
  volumes:
  - name: urandom
    path: /tmp/dev/urandom

volumes:
- name: urandom
  host:
    path: /dev/urandom

If you are running Drone on Kubernetes you may need to enable privileged execution for the step, as show above. If you are running Drone on Docker, privileged mode is not required.

1 Like