Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in container: bind mount permission denied #115

Closed
aminebizid opened this issue Jun 6, 2018 · 11 comments
Closed

in container: bind mount permission denied #115

aminebizid opened this issue Jun 6, 2018 · 11 comments

Comments

@aminebizid
Copy link

I get this error
failed to solve: failed to mount /tmp/buildkit-mount123570778: [{Type:bind Source:/root/.local/share/img/runc/native/snapshots/snapshots/8 Options:[ro rbind]}]: permission denied

when running

running img build -t amine/api .

using this Dockerfile

FROM ttadockerregistry.azurecr.io/aspnetcore-build:2.0 AS build-env
WORKDIR /app

# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out

# Build runtime image
FROM ttadockerregistry.azurecr.io/aspnetcore:2.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "api.dll"]
@jessfraz
Copy link
Collaborator

jessfraz commented Jun 6, 2018

what is your ubuntu version can you also output img version, thanks!

@jessfraz jessfraz added the bug label Jun 6, 2018
@jessfraz jessfraz changed the title I'm running ubuntu ubuntu: bind mount permission denied Jun 6, 2018
@jessfraz jessfraz added the ubuntu label Jun 6, 2018
@aminebizid
Copy link
Author

uname -or
4.13.0-1016-azure GNU/Linux

img version
img:
version : v0.4.4
git hash : 3e14a5b
go version : go1.10.2
go compiler : gc
platform : linux/amd64

@jessfraz
Copy link
Collaborator

jessfraz commented Jun 6, 2018

are you running it with sudo because it looks like it is trying to use /root/.local/share/img/runc/native/snapshots/snapshots/8 as the state dir which implies root... you shouldnt need sudo

@aminebizid
Copy link
Author

I'm running into k8s with an ubuntu:14.04 image
Do I need to create a user?

@aminebizid
Copy link
Author

when using a non root I get this

mg build -t test .
nsenter: cannot change root filesystem propagation: Permission denied

@jessfraz
Copy link
Collaborator

jessfraz commented Jun 6, 2018 via email

@jessfraz
Copy link
Collaborator

jessfraz commented Jun 6, 2018 via email

@jessfraz jessfraz changed the title ubuntu: bind mount permission denied in container: bind mount permission denied Jun 6, 2018
@aminebizid
Copy link
Author

I'm want to run img inside a VSTS agent container running in k8s and using

Linux agent-deployment-6d5f8c7fc8-56jbc 4.13.0-1016-azure #19-Ubuntu SMP Thu May 3 17:29:51 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

@jessfraz
Copy link
Collaborator

jessfraz commented Jun 6, 2018 via email

@aminebizid
Copy link
Author

aminebizid commented Jun 6, 2018

How to do this ?

This is my deployment

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: agent-deployment
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app:
          agent-app
    spec:
      nodeSelector:
        beta.kubernetes.io/os: linux
      containers:
      - image: microsoft/vsts-agent
        name: agent-container
        env:
        - name: VSTS_ACCOUNT
          value: xxx
        - name: VSTS_TOKEN
          value: xxx
        - name: VSTS_POOL
          value: dockerPool

@AkihiroSuda
Copy link
Collaborator

@aminebizid spec.containers[0].securityContext.privileged needs to be true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants