Docker Community Forums

Share and learn in the Docker community.

Cannot open file /var/log/cassandra/gc.log due to Permission denied

Attempting to run Cassandra in a Docker container using folders on the host Windows 10 for persistence; getting a permissions error that stops the container when I’m using WSL 2:

docker pull datastax/dse-server:6.8.2

docker run -e DS_LICENSE=accept -e DC=DC1 --memory 2g -p 9042:9042 -v /mnt/c/docker_data/dse/cassandra_data:/var/lib/cassandra -v /mnt/c/docker_data/dse/cassandra_logs:/var/log/cassandra -v /mnt/c/docker_data/dse/custom:/custom --name dse -d datastax/dse-server:6.8.2

The container launches, then stops, the log shows this:
OpenJDK 64-Bit Server VM warning: Cannot open file /var/log/cassandra/gc.log due to Permission denied

When the WSL 2 option is checked, then there is no file sharing tab under Settings -> Resources

Cassandra runs fine under Hyper-V with an older version, when I shell into the running container it shows that the folder is owned by dse:dse

dse@a750:~$ ls -la /var/log/cassandra/
drwxrwxrwx 1 dse dse 4096 Aug 14 22:28 .

Somehow I need to chown the folder before cassandra starts; something like this:
sudo chown -R dse:dse /mnt/c/docker_data/dse/cassandra_logs