Skip to content

Docker volumes not mounted when using docker:dind

Summary

Docker volumes not mounted when using docker:dind

Steps to reproduce

With the following .gitlab-ci.yml file, the Docker command should return test_file, showing that the /mnt directory was mounted successfully. It returns nothing.

image: docker:latest
services:
  - docker:dind

stages:
  - test

docker:
  stage: test
  script:
    - touch /mnt/test_file
    - docker run -v /mnt:/mnt ubuntu ls /mnt

The Docker image gitlab/dind works, but it is based on jpetazzo/dind, which is obsolete and based on the very old Ubuntu Trusty (from 2014). So mounting the volumes work, but many other things that depend on newer technologies fail.

Example Project

In the following sample project, I'm using the shared CI runners, but other people from #gitlab on freenode tested it with private runners, and have the same problem.

https://gitlab.com/teresaejunior/my-awesome-project/blob/master/.gitlab-ci.yml

Relevant logs and/or screenshots

https://gitlab.com/teresaejunior/my-awesome-project/-/jobs/44977716

Output of checks

This bug happens on GitLab.com (but also on private runners, as shown by other users).

Edited by Teresa e Junior