<p>The easiest solution for me was to execute </p>

<p><code>docker container prune</code></p>

<p>on the runner machine. The command removes all stopped docker containers and the <code>.lock</code> files therein. Running a pipeline from gitlab.com then starts a new container. (Note that all caches will be lost).</p>

CC BY-SA 4.0
2020-03-03T16:08:31.410Z
2020-03-24T18:27:29.610Z
2020-03-24T18:27:29.610Z
M. Heuer
<p>I got a problem on a gitlab-runner after pushing several commits:</p>

<pre><code>Running with gitlab-runner 11.4.0 (8af42251)
   on GITLAB-RUNNER 58c31dfa
 Using Docker executor with image registry.git.rwth-aachen.de/luechow-group/inpsights/gnu:7.3.0 ...
 Pulling docker image registry.git.rwth-aachen.de/luechow-group/inpsights/gnu:7.3.0 ...
 Using docker image sha256:8c48f31ac37d239cf7c072961068e85dd0af222604461b7c0df905a45e900877 for registry.git.rwth-aachen.de/luechow-group/inpsights/gnu:7.3.0 ...
Running on runner-58c31dfa-project-12102-concurrent-0 via GITLAB-RUNNER...
00:05
Fetching changes...
 HEAD is now at 15dd3f8 .
 error: cannot lock ref 'refs/remotes/origin/develop': Unable to create '/builds/luechow-group/inPsights/.git/refs/remotes/origin/develop.lock': File exists.
 Another git process seems to be running in this repository, e.g.
 an editor opened by 'git commit'. Please make sure all processes
 are terminated then try again. If it still fails, a git process
 may have crashed in this repository earlier:
 remove the file manually to continue.
 From https://git.rwth-aachen.de/luechow-group/inPsights
  ! 62d2cd4..f2bb2fe  develop    -&gt; origin/develop  (unable to update local ref)
    15dd3f8..0c2b081  feature/ElectronSelectorRebase -&gt; origin/feature/ElectronSelectorRebase
 Auto packing the repository in background for optimum performance.
 See "git help gc" for manual housekeeping.
 error: cannot lock ref 'refs/remotes/origin/develop': Unable to create '/builds/luechow-group/inPsights/.git/refs/remotes/origin/develop.lock': File exists.
 Another git process seems to be running in this repository, e.g.
 an editor opened by 'git commit'. Please make sure all processes
 are terminated then try again. If it still fails, a git process
 may have crashed in this repository earlier:
 remove the file manually to continue.
 error: failed to run reflog
 ERROR: Job failed: exit code 1
</code></pre>

<p>Which command do I have to use to delete the <code>.lock</code> file in the docker container and to save this change?</p>

<docker><gitlab><gitlab-ci-runner>
Problem on gitlab-runner: cannot lock ref [...] Another git process seems to be running in this repository
M. Heuer
# Problem on gitlab-runner: cannot lock ref [...] Another git process seems to be running in this repository

(Asked by: username_0 on 2020-03-03)

I got a problem on a gitlab-runner after pushing several commits:
Running with gitlab-runner 11.4.0 (8af42251)
   on GITLAB-RUNNER 58c31dfa
 Using Docker executor with image registry.git.rwth-aachen.de/luechow-group/inpsights/gnu:7.3.0 ...
 Pulling docker image registry.git.rwth-aachen.de/luechow-group/inpsights/gnu:7.3.0 ...
 Using docker image sha256:8c48f31ac37d239cf7c072961068e85dd0af222604461b7c0df905a45e900877 for registry.git.rwth-aachen.de/luechow-group/inpsights/gnu:7.3.0 ...
Running on runner-58c31dfa-project-12102-concurrent-0 via GITLAB-RUNNER...
00:05
Fetching changes...
 HEAD is now at 15dd3f8 .
 error: cannot lock ref 'refs/remotes/origin/develop': Unable to create '/builds/luechow-group/inPsights/.git/refs/remotes/origin/develop.lock': File exists.
 Another git process seems to be running in this repository, e.g.
 an editor opened by 'git commit'. Please make sure all processes
 are terminated then try again. If it still fails, a git process
 may have crashed in this repository earlier:
 remove the file manually to continue.
 From https://git.rwth-aachen.de/luechow-group/inPsights
  ! 62d2cd4..f2bb2fe  develop    -> origin/develop  (unable to update local ref)
    15dd3f8..0c2b081  feature/ElectronSelectorRebase -> origin/feature/ElectronSelectorRebase
 Auto packing the repository in background for optimum performance.
 See "git help gc" for manual housekeeping.
 error: cannot lock ref 'refs/remotes/origin/develop': Unable to create '/builds/luechow-group/inPsights/.git/refs/remotes/origin/develop.lock': File exists.
 Another git process seems to be running in this repository, e.g.
 an editor opened by 'git commit'. Please make sure all processes
 are terminated then try again. If it still fails, a git process
 may have crashed in this repository earlier:
 remove the file manually to continue.
 error: failed to run reflog
 ERROR: Job failed: exit code 1

Which command do I have to use to delete the .lock file in the docker container and to save this change?

**Tags:** docker, gitlab, gitlab-ci-runner


---

## 1 answers

### Answer by username_0 on 2020-03-03. Score: 3 | Accepted answer

The easiest solution for me was to execute

`docker container prune`

on the runner machine. The command removes all stopped docker containers and the `.lock` files therein. Running a pipeline from gitlab.com then starts a new container. (Note that all caches will be lost).


---

