2

I'm trying to create a volume to be shared among the containers, and this volume binds to a location of my host, the problem is that every time I run the docker-compose up gives the following error:

In file '. \ docker-compose.yml', service 'volumes' must be a mapping not an array.

and so far I didn't understand why. Following is the compose file:


version : '3.4'

services:
    testando-volume-compartilhado-a:
      image: carloshenriquecarniatto/teste:latest

    volumes:
       - D:\App:/app
    ports:
        - "10001:80"
        - "44378:443" 
Pierre.Vriens
  • 7,225
  • 14
  • 39
  • 84

2 Answers2

4

It seems there is a spacing issue in your yaml

You should change the compose file to

version : '3.4'

services:
    testando-volume-compartilhado-a:
      image: carloshenriquecarniatto/teste:latest

    volumes:        
        - D:\App:/app  # <- extra space here
    ports:
        - "10001:80"
        - "44378:443" 
Bruce Becker
  • 3,783
  • 4
  • 20
  • 41
0

It is a spacing issue, but because of indentation.

volumes and ports should be at the same level of image

version : '3.4'

services: testando-volume-compartilhado-a: image: carloshenriquecarniatto/teste:latest

  volumes:
     - D:\App:/app
  ports:
      - "10001:80"
      - "44378:443" 

I am not sure about the Windows volume mapping (Linux only here)...but the indentation was off for sure!