Skip to content
GitLab Next
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Menu
    Projects Groups Snippets
  • Sign up now
  • Login
  • Sign in / Register
  • gitlab-runner gitlab-runner
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 2,410
    • Issues 2,410
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 131
    • Merge requests 131
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

GitLab 15.0 has launched! Please visit Breaking changes in 15.0 and 15.0 Removals to see which breaking changes may impact your workflow.

  • GitLab.org
  • gitlab-runnergitlab-runner
  • Issues
  • #3207
Closed
Open
Created Apr 09, 2018 by Trey Duskin@treyd

Configure docker volumes in .gitlab-ci.yml

Description

For CI jobs that build containers and need to interact with and share docker volumes, it would be helpful if the volumes could be specified in .gitlab-ci.yml (and optionally cleaned up by the runner), instead of having to specify the volumes in config.toml.

Proposal

Add a new parameter in .gitlab-ci.yml called volumes which can be used either globally, or in an individual job, that will bind mount the volume. E.g.:

volumes:
  name: named-volume
  path: /path/to/volume/in/container
  mode: rw
  persist: true

The name, path and mode correspond to the three parts of a docker volume mount string (i.e. -v named-volume:/path/to/volume/in/container:rw). The persist keyword is an optional parameter to tell the runner to leave the volume alone at the end of the job, otherwise it will be deleted.

Links to related issues and merge requests / references

None that I know of, although I've seen references to a gitlab-ci.yml version 3 that might support this? Apologies if so.

Assignee
Assign to
Time tracking