Search code examples
dockerdocker-composedocker-swarm

Using docker-compose 1.8 bundle with Swarm 1.12


I am using docker 1.12 version and compose 1.8. I am trying to understand how to mount the volumes for the image. This is for create a cluster and save the data to local volume

This is the docker-compose.yml:

version: '2'
services:
  mongod:
    image: rotemsecupi/mongodb-ubuntu
    ports:
      - "27017"
    volumes:
       - /home/dbdata/mongodb:/data/db
    command: mongod --smallfiles --quiet --logpath=/var/log/mongodb.log

This is the error that I get:

WARNING: Unsupported top level key 'volumes' - ignoring

WARNING: Unsupported key 'volumes' in services.momgodb - ignoring

Best regards


Solution

  • This isn't supported yet, as you can see from the error message. The new swarm features are still under very active development and the bundles themselves are experimental, so there are lots of pieces like this still pending development.

    Volumes are presently supported in the swarm mode with the docker service --mount option (documentation is still needed on this). You'll need to ensure that the volume actually exists on the host, which, due to the nature of Swarm and containers able to be scaled onto multiple hosts, is likely the reason for this feature to be lower in the priority list.