Carlos Jimenez Bermudez
Carlos Jimenez Bermudez

Reputation: 1175

Docker: mount: permission denied (are you root?) on DIND

So, I'm trying to build a docker in docker image to use as a base image in Gitlab CI. The image buids just fine, but when I try to run it, I get the following error despite using the privileged flag:

mount: permission denied (are you root?)

The run command is the following: docker run gitlab-dind-base --privileged --name 'gitlab-test' -it -d

The name is also not being set properly despite being specified.

This is my dockerfile:

FROM docker:dind
RUN apk add curl
RUN apk add unzip
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
RUN unzip awscliv2.zip
RUN ./aws/install
RUN apk update
RUN apk add bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib wget
RUN apk update
RUN wget https://dot.net/v1/dotnet-install.sh -O $HOME/dotnet-install.sh
RUN chmod +x $HOME/dotnet-install.sh
RUN $HOME/dotnet-install.sh -c 5.0

I know this is a very noob question, but I am new to docker in general and mostly use Docker Desktop since I am not that familiar with the CLI yet, can anyone help me point out what is wrong?

Thanks,

Upvotes: 4

Views: 12065

Answers (1)

Jeremy
Jeremy

Reputation: 363

You can try to update the following file /etc/gitlab-runner/config.toml by putting the privileged variable to true just like this :

concurrent = 1
check_interval = 0

[[runners]]
  name = "kms"
  url = "http://example.org/ci"
  token = "3234234234234"
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "alpine:3.4"
    privileged = true
    disable_cache = false
    volumes = ["/cache"]
  [runners.cache]
    Insecure = false

I didn't try it myself but it could be a solution though!

Upvotes: 2

Related Questions