Search code examples
dockerdocker-composepermissions

When using docker-compose why are my files mounting like folders?


I tried the following...

    volumes:
      - ./cassandra:/cassandra
      - ./cassandra/init-cassandra.cql:/etc/cassandra/init-cassandra.cql

where

$ ls -al cassandra/init.sh
-rwxr-xr-x 1 me 1049089 228 Aug 29 16:36 'cassandra/init.sh'

But when I exec into the image I see the files but they are directories

root@e896458f2fd0:/# ls -l cassandra
total 0
drwxr-xr-x 2 cassandra root 40 Aug 29 20:10 init-cassandra.cql
drwxr-xr-x 2 root      root 40 Aug 29 20:38 init.sh
drwxr-xr-x 3 root      root 60 Aug 29 20:38 out

But it shouldn't be a directory

full Yaml

  init:
    image: containerregistry-na.jpmchase.net/container-external/docker.io/cassandra:4.0.0
    restart: "no"
    volumes:
      - ./cassandra:/cassandra
      - ./cassandra/init-cassandra.cql:/etc/cassandra/init-cassandra.cql

Solution

  • This was due some permissioning issues with the virtual file system we were using. I had to make sure the folder I was using was in my User folder to avoid this.