Docker cannot mount volume over existing file

I am doing this on a AWS Linux Instance

Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5/1.9.1
 Built:
 OS/Arch:      linux/amd64

Server:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5/1.9.1
 Built:
 OS/Arch:      linux/amd64

Whenever I try to docker-compose up -d with the following docker-compose.yml (this is an excerpt)

  • Docker not supported on 32-bit OS
  • How to use the docker remote API?
  • Docker and Kubernetes repository for linux
  • How to hot deploy Java EE applications in Docker containers
  • How to duplicate container using existing images
  • Docker error resolve host and I/O error on POST request for http://es.example/oauth/check_token Connection refused
  • elasticsearch:
      image: elasticsearch:2.1.1
      command: elasticsearch
      ports:
      - "9200:9200"       
      - "9300:9300"
      volumes:
      - ./elk/es/staging.yml:/etc/elasticsearch/elasticsearch.yml
      links: 
      - kibana
      volumes_from:
      - es-data
    
    es-data:
      image: elasticsearch:2.1.1
      command: "true"
      volumes:
      - /usr/share/elasticsearch/
      - /etc/default/elasticsearch
      - /var/lib/elasticsearch/
      - /var/log/elasticsearch
    

    I’ll receive this error:

    Recreating es-data_1
    ERROR: cannot mount volume over existing file, file exists /var/lib/docker/devicemapper/mnt/33111596cd765c4220c65ea7cc35df4a6c295a860e4ad94294c7ee985da6ea7c/rootfs/etc/default/elasticsearch
    

    I’ve tried bypassing this error by removing the volumes from es-data, but that is not ideal as I’m using it as a data only container.

    I’ve tried removing all the volumes available on the system using docker volume rm $(docker volume ls -q), but that removes all of the volumes except one that I am not sure how to force remove.

    Ideal situation would be to allow me to reuse that volume (which I’m assuming is orphaned at this point). Second ideal situation would be able to remove the volume and be able to create a new one.

    If I was doing this on my personal machine, I would take the easier approach of recreating the docker-machine I am using as a clean slate, but I don’t want to do that on my AWS instance.

  • How to use COPY command in Docker build?
  • How to view netstat of a container within another container?
  • Docker:issue faced while running two web apps inside docker
  • Microservices and database
  • Dockerfile - Mount host directory - copy a tar fie and run it - Error
  • Docker - Failed to connect to localhost port 4000: Connection refused
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.