Getting invalid mount config for type “bind”: bind source path does not exist in docker

孤人 提交于 2019-12-10 13:33:28

问题


I am trying to deploy following docker-compose into docker swarm cluster.

version: '3.2'
services:
  jenkins:
    image: jenkins/jenkins:lts
    ports:
      - 8080:8080
    volumes:
      - ./data_jenkins:/var/jenkins_home
    deploy:
      mode: replicated
      replicas: 1

I do have the data_jenkins in the same locations where docker-compose is and passing that path as volume . But why is it throwing the source path does not exist. What exactly is the problem.

Also if the directory doesnot exist -v should have created it right. Why is it not ?


回答1:


This is clearly documented in Docker Swarm BIND MOUNTS

If you bind mount a host path into your service’s containers, the path must exist on every swarm node. The Docker swarm mode scheduler can schedule containers on any machine that meets resource availability requirements and satisfies all constraints and placement preferences you specify.

Unlike running a single container, the bind-mount host directory is not created if it doesn't exit. It must exist prior to running the container on a cluster node.



来源:https://stackoverflow.com/questions/48971065/getting-invalid-mount-config-for-type-bind-bind-source-path-does-not-exist-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!