Docker encountered a problem 4: yaml: Line 1: mapping values are not allowed in this context

refer to the example of the official document part3 and execute the docker stack deploy-c docker-composer. Yml getstartedlab with the error message as follows:

cappuccinooos-MacBook-Pro:part3 cappuccinooo$ docker stack deploy -c docker-compose.yml  getstartedlab
yaml: line 1: mapping values are not allowed in this context

from the error message can know, is docker – compose. Yml file format has a problem, yml file has strict requirements on the blank space indentation, direct copy the contents of the official document is not enough, the search on the net have tools to online check yml file format, format errors will give corresponding hint, feel quite convenient, and the link below: https://www.bejson.com/validators/yaml/

after modifying the docker-composer. Yml, execute the docker stack deploy-c docker-composer. Yml getstartedlab command successfully

cappuccinooos-MacBook-Pro:part3 cappuccinooo$ docker stack deploy -c docker-compose.yml  getstartedlab
Creating network getstartedlab_webnet
Creating service getstartedlab_web

Read More: