Search code examples
dockerdocker-composedockerfiledocker-swarmdocker-stack

Docker stack deploy with compose-file results in invalid mount config for type "bind": bind source path does not exist:


I am trying to deploy my containers and getting this error (from docker stack ps testapp --no-trunc) : invalid mount config for type "bind": bind source path does not exist: /home/john/valet/testapp . I am using docker-compose. I understand that before deployment it makes my relative volume mappings into absolute ones and on the remote host the /home/john/valet/testapp doesn't exist.

  volumes:
        - ./:/var/www/:cached

but I am not really sure how to resolve this.

P.S. Locally everything works great with docker-compose build && docker-compose up -d and on docker hub, my auto builds are also successfully building.

Edited : Just in case adding repo of the source code: https://github.com/neorganic/dockertest


Solution

  • So the actual problem was the fact that I didn't understand that the volume must exist on the host I am deploying the containers. For some reason, I thought it was being copied/synchronized from my local device.

    I also came to conclusion that the complexity of getting your source code to host in docker-swarm is something that I would rather not have when kubernetes have this solved, so I am switching to kubernetes (and gc for that matter).