Docker --volume gives "permission denied: unknown"

34 Views Asked by At

I have a very simple Dockerfile based on Ubuntu that installs a few packages

FROM ubuntu:22.04

RUN apt-get update &&  \
    apt-get install -y \
    cmake              \
    g++                \
    git                \
    python3            \
    htop               

I build it using docker build -t myimage ..

Then I try to run it using

docker run -it          \
    -w $(pwd)           \
    -v $HOME:$HOME      \
    myimage

such that my home directory /lab/home/me is mounted, and such that the current directory /lab/home/me/dev/lib is set as the working directory.

However I get the following error

docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: mkdir /lab/home/me/dev: permission denied: unknown.

I don't understand because I have the permissions drwx------ for /lab/home/me/dev when I am outside docker, so I can mkdir without any issue.

What is the problem exactly?

0

There are 0 best solutions below