G
G
gubber2018-06-30 14:07:51
Docker
gubber, 2018-06-30 14:07:51

Why not enough permissions to read the file when using a named Docker volume?

I have an application running on docker-compose

version: "3.0"
services:
  static:
...
    volumes:
      - share-images:/usr/share/imgs
  bus:
...
    volumes:
      - share-images:/usr/share/imgs
volumes:
     share-images:

Bus is a java application that saves files (images) into a named volume.
static is the nginx server that renders the image data.
But by default, nginx gives me a 403 error when displaying an image. If you look at the file structure from the static container, you can see that there are not enough privileges to read the file.
# ls -al /usr/share/imgs
total 456
drwxr-xr-x 2 root root   4096 Jun 30 10:44 .
drwxr-xr-x 1 root root   4096 Jun 30 10:24 ..
-rw-r----- 1 root root 175804 Jun 30 10:44 27278103-9d2f-4599-8599-f9fc066c5bb5.jpg

If you run chmod +r on the file, then everything will work.
How should volumes be configured in the docker-compose file so that the rights are automatically set correctly in the static container?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question