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:

  • boot2docker startup script to mount local shared folder with host
  • docker-compose - database migrations and other pre/post scripts
  • docker build in run time or docker compose from images
  • Host volumes / environment variables not available during container build stage
  • How to run a meteor app in docker on mac?
  • How to use variable in Marathon Docker parameters
  • 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

  • kubernetes service external ip pending
  • not able to install groovy using sdkman in docker image
  • Google Container Engine Expose Service “Site Cannot Be Reached”
  • Assigning IP address to docker containers?
  • Ansible ignores remote_user switch
  • Using AWS Simple Workflow to start a docker container
  • 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.