Unable to bind mount in service create on a swarm created using docker for AWS

Expected behavior

Service should be created successfully.

Actual behavior

Gives the following error

invalid mount config for type \"bind\": bind source path does not exist

The error is for this mount that I am doing --mount type=bind,source=/var/jenkins_home,d estination=/var/jenkins_home

Additional Information

Docker CE for aws stable aws-v17.03.1-ce-aws1
Docker server version 17.03.1-ce
Kernel Version: 4.9.13-moby
Operating System: Alpine Linux v3.5

Steps to reproduce the behavior

  • ssh into the manager node using ssh -i key.pem docker@
  • mkdir -p /var/jenkins_home
  • Create a service using the following command

docker service create --name jenkins -p 8080:8080 --constraint ‘node.hostname==ip-xxx-xx-x-xx.us-west-2.compute.internal’ --mount type=bind,source=/var/jenkins_home,d
estination=/var/jenkins_home --mount type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock --mount type=bind,source=$(which docker),destination=/bin/docker
–network jenkins-network jenkins
```

I hit this problem on Windows using Git Bash - I thought it was due to my setup, but then I tried an older Jenkins (jenkins:2.7.4-alpine to be precise) and it then worked - so this would suggest something has changed in the recent jenkins image that caused my problem.

Maybe try an older version and see if that fixes your problem?

1 Like