I’m facing an issue while trying to run a GitLab Runner container on my machine. The command I’m using is:
sudo docker run -d --privileged --name gitlab-runner --restart always \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest
But every time I run this, I get the following error:
docker: Error response from daemon: error while creating mount source path '/srv/gitlab-runner/config': mkdir /srv/gitlab-runner: read-only file system.
Things I’ve Tried:
Changing Directory Permissions I attempted to modify the permissions on the /srv directory by running:
sudo chown 1000:1000 /srv/gitlab-runner
But this didn’t resolve the issue.
Checking Mount Options I used the mount command to verify if /srv (or the root / file system) was mounted as read-only. It seems to be mounted as read-only (ro).
Trying to Remount I attempted to remount /srv as read-write:
sudo mount -o remount,rw /srv
This did not work either, and I’m still facing the same read-only error.
Question:
Does anyone know why Docker is unable to create directories in /srv and why it's mounted as read-only? Could this be due to specific settings in Debian, or something related to Docker’s permissions? Any solutions or workarounds to allow /srv/gitlab-runner/config to be writable by Docker would be greatly appreciated!
Thank you in advance for your help!
The output of docker info is:
sudo docker info
Client: Docker Engine - Community
Version: 27.3.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.17.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.29.7
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 2
Running: 1
Paused: 0
Stopped: 1
Images: 2
Server Version: 24.0.5
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 3dce8eb055cbb6872793272b4f20ed16117344f8
runc version:
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 5.15.0-124-generic
Operating System: Ubuntu Core 22
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.61GiB
Name: machine1
ID: b356d3b3-4571-4b1b-8130-1a6aa7bc2c9d
Docker Root Dir: /var/snap/docker/common/var-lib-docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
every time I run this, I get the following error"Where" do you get the error? In the terminal right after running the command? Are there any other mesasges? Do you see anythnig injournalctlorsystemctl status docker? On the host what is the output offindmntormount? Are you executing the command inside another docker container? What is the output ofdocker info? isDOCKER_HOSTvariable set? Are you sure you want to do that? Why are you using privileged if you are mounting docker.sock from host?The problem that Iwhy or how is that aproblem?/var/snap/docker/common/var-lib-dockerYour docker is running in snap? I guess this might be an issue, but I know nothing about snap.