Hi, I am trying to use the example provided in the site https://docs.docker.com/compose/gettingstarted/
Step 3: Define services Define a set of services using docker-compose.yml:
Create a file called docker-compose.yml in your project directory and add the following:
version: '2'
services:
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
depends_on:
- redis
redis:
image: redis
and when I run the command docker-compose up i got the below error
ERROR: yaml.scanner.ScannerError: while scanning for the next token found character ‘\t’ that cannot start any token in “./docker-compose.yml”, line 18, column 1 so i removed all spaces and modified it as below
version: ‘2’ services: web: build: . #Build from the dockerfile from current dir ports:
on trying it again i am getting an error now as
docker-compose up ERROR: In file ‘./docker-compose.yml’, service must be a mapping, not a NoneType.
Can I get some help what is wrong here… I am using MAC.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
This question was answered by @VVP:
i got the right file
version: ‘2’ services: web: build: . ports:
- “5000:5000” volumes:
- .:/code
- logvolume01:/var/log links:
- redis redis: image: redis volumes: logvolume01: {}
This is working … can refer the following link
i got the right file
version: ‘2’ services: web: build: . ports: - “5000:5000” volumes: - .:/code - logvolume01:/var/log links: - redis redis: image: redis volumes: logvolume01: {}
This is working … can refer the following link
https://docs.docker.com/compose/overview/ :)