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 does Istio compare to Traefik?
  • docker: Couldn't connect to Docker daemon
  • Docker, redirecting to virtualbox port
  • WordPress Docker won't increase upload limit
  • Kitchen login failed :Could not resolve host name
  • Cronjobs in Docker container how get them running?
  • 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

  • Rails app in docker container doesn't reload in development
  • How to get contents generated by a docker container on the local fileystem
  • Clean up dangling Docker Containers in githost hosted gitlab-ci runners?
  • Error while composing a docker image
  • Docker killed by system when build
  • How to enable the Docker Remote API on Windows
  • 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.