Martin Larizzate
Martin Larizzate

Reputation: 910

Ubuntu and Docker: Error response from daemon: error while creating mount source path

I want to use a volume mounted on my container but it throws the next error when trying to run:

docker: Error response from daemon: error while creating mount source path '/var/skeeter/templates': mkdir /var/skeeter: read-only file system.

This is my Dockerfile:

FROM maven:3-jdk-13-alpine

RUN mkdir -p /var/container/skeeter/templates

WORKDIR /project
ADD ./target/skeeter-0.0.1-SNAPSHOT.jar skeeter-0.0.1-SNAPSHOT.jar

EXPOSE 8080

CMD java -jar skeeter-0.0.1-SNAPSHOT.jar

And this is the run cmd:

docker run -t -p 8080:8080 -v /var/skeeter/templates:/var/container/skeeter/templates --name skeeter-docker-container skeeter-docker-image:latest

This is the CMD output when i'm checking the directories permissions:

ls -l /var/skeeter/
total 4 drwxrwxrwx 2 root root 4096 ago 11 16:45 templates

ls -ld /var/skeeter/
drwxrwxrwx 3 root root 4096 ago 11 16:45 /var/skeeter/

Update: I created a new Volume and used its name at -v parameter and it runned, but java app cannot find files inside the directory

Upvotes: 5

Views: 22335

Answers (1)

Martin Larizzate
Martin Larizzate

Reputation: 910

It was just a permissions issue. I moved the source directory to /home/myuser/directory/ and worked.

Upvotes: 7

Related Questions