title: Operation not permitted on gitlab-runner
body: <p>I'm trying to run a gitlab ci on my own server. I registered gitlab-runner in a separated machine using privileges</p>
  <pre><code>sudo gitlab-runner -n \
    --url https://git.myServer.com/ \
    --registration-token TOKEN \
    --executor docker \
    --description &quot;Docker runner&quot; \
    --docker-image &quot;myImage:version&quot; \
    --docker-privileged
  </code></pre>
  <p>Then I created a simple <code>.gitlab-ci.yml</code> configuration</p>
  <pre><code>stages:
    - build
  
  default:
    image: myImage:version
  
  build-os:
    stage: build
    script: ./build
  </code></pre>
  <p>My build script builds some cpp files and triggers some cmake files. However, one of those cmake files fails when trying to execute configure_file command</p>
  <pre><code>CMake Error at CMakeLists.txt:80 (configure_file):
    Operation not permitted
  </code></pre>
  <p>I think it's a problem of privileges of my gitlab-runner but I registered it with sudo privileges.</p>
  <p><strong>Any idea of what I'm missing? thank you!</strong></p>
  <p><strong>edit:</strong>
  Here's my config.toml file</p>
  <pre><code>concurrent = 1
  check_interval = 0
  
  [session_server]
    session_timeout = 1800
  
  [[runners]]
    name = &quot;Description&quot;
    url = &quot;https://git.myServer.com/&quot;
    token = &quot;TOKEN&quot;
    executor = &quot;docker&quot;
    environment = [
        &quot;DOCKER_AUTH_CONFIG={config}&quot;,
        &quot;GIT_STRATEGY=clone&quot;,
    ]
    clone_url = &quot;https://git.myServer.com&quot;
    builds_dir = &quot;/home/gitlab-runner/build&quot;
    [runners.custom_build_dir]
    [runners.cache]
      [runners.cache.s3]
      [runners.cache.gcs]
      [runners.cache.azure]
    [runners.docker]
      tls_verify = false
      image = &quot;myImage:version&quot;
      privileged = true
      disable_entrypoint_overwrite = false
      oom_kill_disable = false
      disable_cache = false
      volumes = [
          &quot;/tmp/.X11-unix:/tmp/.X11-unix&quot;,
          &quot;/dev:/dev&quot;,
          &quot;/run/user/1000/gdm/Xauthority:/home/gitlab-runner/.Xauthority&quot;,
      ]
      memory = &quot;8g&quot;
      memory_swap = &quot;8g&quot;
      ulimit = [&quot;core=0&quot;, &quot;memlock=-1&quot;, &quot;rtprio=99&quot;]
      shm_size = 0
      pull_policy = [&quot;if-not-present&quot;]
      network_mode = &quot;host&quot;
  </code></pre>
  <p>I have also tried changing the user from gitlab-runner to my host user following <a href="https://stackoverflow.com/a/40703269/13154650">this</a> but it didn't work.</p>
  <p>This is the <a href="https://github.com/raulmur/ORB_SLAM2/blob/master/Thirdparty/g2o/CMakeLists.txt#L79" rel="nofollow noreferrer">line</a> which makes my build fail.</p>