Docker Executor: Cannot mount shared host directories via -v after upgrading to 16.8.4 #3172
kobe opened 13 hours ago

Environment

  • OneDev Version: 16.8.4
  • Previous Version: 16.7.3
  • Deployment: Docker
  • Job Executor: Docker Executor (including remote Docker execution)
  • Build Tools: Maven, npm

Problem Description

After upgrading OneDev from 16.7.3 to 16.8.4, our existing CI/CD jobs started failing because Docker volume mounts using -v are no longer accepted.

We have multiple Java and frontend projects, and all projects share the same Maven and npm dependency caches stored on the Docker host.

Previously, we configured the following Docker run options:

-v /opt/leosys/onedev/cache/maven:/root/.m2/repository
-v /opt/leosys/onedev/cache/npm:/root/.npm

This allowed different projects to reuse the same dependency caches without repeatedly downloading dependencies.

Actual Behavior

After upgrading to 16.8.4, the build fails with:

Running step "Backend Build -> Maven Package"...
Docker run option '-v' is not allowed: volume mounts are managed by the executor
Step "Backend Build -> Maven Package" is failed

I also tried configuring the same volume mounts in:

Administration → Job Executors → Docker Executor → More Settings → Run Options

However, the configuration form reports:

Option '-v' is reserved

Therefore, the volume mounts cannot be configured at either the job step level or the executor level through Docker run options.

Why Shared Host Caches Are Important

We use Docker Executors to build multiple projects, and some builds run on remote Docker hosts.

Our requirements are:

  1. All Java projects should share a single Maven dependency cache.
  2. All frontend projects should share a single npm cache.
  3. Dependency caches should remain on the remote Docker host.
  4. Builds should not need to download and upload several gigabytes of dependency caches from/to the OneDev server on every execution.
  5. We would prefer to keep using Docker Executors rather than switching to Shell Executors.

OneDev's built-in Job Cache supports sharing caches through a parent project, but this appears to require transferring cache data between the remote executor and the OneDev server.

For large Maven/npm caches, this introduces unnecessary network traffic and build overhead.

Expected Behavior

We would like Docker Executors to support mounting explicitly configured, trusted host directories into build containers.

Ideally, an administrator could configure shared volume mounts at the Docker Executor level, for example:

Host: /opt/leosys/onedev/cache/maven
Container: /root/.m2/repository

Host: /opt/leosys/onedev/cache/npm
Container: /root/.npm

These mounts would then be available to jobs using that executor, without allowing individual jobs to mount arbitrary host paths.

This could preserve security while allowing efficient dependency caching across multiple projects.

Questions

  1. Is blocking the -v option an intentional restriction in newer versions of OneDev?
  2. Is there currently a supported way to configure shared host volume mounts at the Docker Executor level?
  3. If host volume mounts are not supported, what is the recommended approach for sharing large Maven/npm caches across multiple projects running on remote Docker Executors, without repeatedly transferring cache archives through the OneDev server?
  4. Would it be possible to add administrator-managed, read/write volume mounts to Docker Executor settings?

Thank you!

1/1
Type
Enhancement
Priority
Critical
Assignee
Labels
No labels
Issue Votes (0)
Watchers (4)
Reference
OD-3172
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover