Compose: Volume must be a mapping, not an array

Created on 9 Aug 2017  路  5Comments  路  Source: docker/compose

The problem is when I try to use the long syntax present in version 3.2.

I've searched but not found anything related to this in the open issues.

Using the same code as in file reference, but getting this error message.

Here is a screenshot with more information about the versions on my machine.

docker: 17.06.0-ce, build 3dfb8343
docker-compose: version 1.15.0, build e12f3b9

screenshot_20170809_132255

kindocs

Most helpful comment

How am I supposed to mount directory from the host as a read-only volume with that syntax?

Related to https://github.com/docker/compose/issues/4675 and https://github.com/docker/docker.github.io/pull/4142

All 5 comments

Yes, that example is completely wrong. Here's what it should look like:

version: "3.2"
services:
  web:
    image: nginx:alpine
    ports:
      - "80:80"
    volumes:
      - type: volume
        source: mydata
        target: /data
        volume:
          nocopy: true
      - type: bind
        source: ./static
        target: /opt/app/static

networks:
  webnet:

volumes:
  mydata:

cc @londoncalling Was this changed recently?

@shin- I think when I tried to update Compose reference file examples for context / structure of the Compose file, I didn't get it right some/all of the time :-(

This probably needed a more thorough review: https://github.com/docker/docker.github.io/pull/3967/files. Can you take a look through these changed samples when you get a chance?

Then, I can fix anything else that is wrong there, as a part of the PR I'm about to open for this issue?

Closing via docker/docker.github.io#4142

Thanks @londoncalling !

How am I supposed to mount directory from the host as a read-only volume with that syntax?

Related to https://github.com/docker/compose/issues/4675 and https://github.com/docker/docker.github.io/pull/4142

GET RID OF THE INDENTATION RULES ON A SIMPLE "WHO I AM " FILE!

Was this page helpful?
0 / 5 - 0 ratings