By VVP
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.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.