volume mounts preventing startup in container

I am able to start Cassandra in a docker container fine, but when I add a volume mount to the run command, Cassandra won’t start and hangs. I am using the official latest Apache Cassandra image (v 3.10), running Docker version 17.04.0-ce.

This starts ok:

  • how to get logs in docker alipne haprox:1.5 logging
  • Does 'docker run' modify image state?
  • Docker Host And Other Fundamental Questions
  • Docker container image on AWS
  • Flanneld not working in Kubernetes Multinode Example
  • Docker image's ID and sha256 are this field related and how generated
  • docker run -d -P --name=cassandra --net=host cassandra

    This hangs:

    docker run -P -v /home/joe/apache-cassandra/data:/var/lib/cassandra --name=cassandra --net=host cassandra

    When it hangs, the last line in the Cassandra log is:

    INFO  [main] 2017-05-29 16:16:48,567 ColumnFamilyStore.java:406 - Initializing system.IndexInfo

    I suspect it’s a permission problem, so here’s what the permissions look like for the host directory

    0 drwxrwx--- 1 root vboxsf 0 May 29 14:36 commitlog 
    0 drwxrwx--- 1 root vboxsf 0 May 29 14:36 data 
    0 drwxrwx--- 1 root vboxsf 0 May 29 12:14 hints 
    0 drwxrwx--- 1 root vboxsf 0 May 29 12:44 saved_caches

    When the container runs without the volume mount, I notice the equivalent directories within the container are owned by “cassandra” and not “vboxsf”.

    Any idea how to fix the issue?

    • Joe

  • Prometheus vs ElasticSearch. Which is better for container and server monitoring?
  • How to log in gcloud with a dockerfile
  • dependency error while installing docker 1.12 in rhel 7
  • DOCKER for setting up BitBucket
  • Docker event output formatting
  • Docker and UFS filesystem
  • One Solution collect form web for “volume mounts preventing startup in container”

    To “fix” this issue, run your container with another path, such as /data-cassandra

    The problem is your /home/joe/apache-cassandra/data is mount from your vbox host. Docker can’t change owner or permission of this.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.