Docker Community Forums

Share and learn in the Docker community.

Networks must be a mapping

docker
swarm

(Jnprogrammer) #1

I’m doing the tutorial in the documentation, currently I’m on section 3. I’ve reached the point where I need to run the command

docker stack deploy -c docker-compose.yml getstartedlab

my yml file is as follows:

 version: "3"
    services:
      web:
        # Super
        image: get-started:part1
        deploy:
          replicas: 5
          resources:
            limits:
              cpu: "0.1"
              memory: 50M
          restart_policy:
            condition: on-failure
        ports:
          - "4000:80"
        networks:
          - webnet
    networks:
    webnet:

When I run the command I get the output

networks must be a mapping

I’m new to docker and I’m reading up on this, but I’ve not found any posts addressing this type of issue.


(Jnprogrammer) #2

Okay I fixed the issue, it was one I typed “cpu” when it should of been “cpus
also webnet should of been aligned with networks by its semicolon and that fixed it. . yml files edited in vim is the only way to go.