0

In local development you can use docker-compose to attach data volume containers to app/db containers like so:

  mongo:
    image: mongo:3
    volumes:
      - data:/data/db
    ports:
      - 27017:27017
      - 28017:28017

  volumes:
    data:

This is pretty great and easy. However, if you want to deploy via Docker Cloud. Their docker-cloud.yml stack files don't allow for this. They throw an error if you try to define data volume containers.

Are data volume containers not supported in Docker Cloud? How are you supposed to persist data and configurations that need to be mounted into your app/db containers?

joshontheweb
  • 612
  • 1
  • 6
  • 18

1 Answers1

1

The code you've posted is for a Docker compose file, but Docker Cloud doesn't support it (I'm assuming that you're not working in swarm beta mode).

You need to use a stackfile, that isn't a Docker compose file.

You need to use a code like this, that automatically generate a volume for your service:

  mongo:
    image: mongo:3
    volumes:
      - /data/db
    ports:
      - 27017:27017
      - 28017:28017

Follow the Docker Cloud stackfile reference for volumes and take a look at Docker Cloud Volumes documentation to get more information about this.

lifeisfoo
  • 15,478
  • 6
  • 74
  • 115