service 'image' must be a mapping not a string

Viewed 32012

I am following a tutorial on udemy and followed the exact steps the tutor did and wrote a docker compose file, but when I enter the command to build and run the app the following error occurs: In file '.\docker-compose.yml', service 'image' must be a mapping not a string.

I tried changing the image to image: redis:alpine instead of image: redis as mentioned on docker docs but it still gives the same error, I even tried image: 'redis'.

version: '3'
services:
 redis-server:
   image: redis
 node-app:
   build: .
 ports:
   - "4081:8081"
1 Answers

I think it's just indentation :

version: '3'
services:
    redis-server:
       image: redis
    node-app:
       build: .
       ports:
           - "4081:8081"

Hope it helps

Related