Mounting Volumes when using Docker module in Ansible

Here is a snippet from my Ansible playbook …

My problem is that I can not get the host and container to mount. The specific line is:
– /home/vagrant/programs/Jenkins:/var/jenkins_home:rw

  • Get memory limit in docker file?
  • What are the best practices to manage and move Docker containers?
  • Issue with assigning static IP to docker container using Terraform
  • Docker run command from git repo?
  • Setting Rails/Rack Environment When Using Docker Compose
  • AWS Configure Bash One Liner
  • If I simply change the line to the below the container starts fine, but there is no mount to the host
    – /home/vagrant/programs/Jenkins

    I am also not sure how I can find any logging to trace is there is a permissions issue or something like that.

    Using Ansible 2.2.0.0 and Docker 1.12.3 on Ubuntu Trusty.

    - name: docker and jenkins
      docker:
        name: jenkins
        image: jenkins
        state:  started
        ports:
        - "8080:8080"
        - "50000:50000"
        volumes:
       **- /home/vagrant/programs/jenkins:/var/jenkins_home:rw**
    

    Thanks

    Alistair

  • Syntaxnet spec file and Docker?
  • Docker unable to ping container from host
  • When, where and how does Visual Studio 2017 set the DOCKER_BUILD_SOURCE environment variable
  • How copy resources files with sbt docker plugin
  • Django show “It worked” page instead of my project when I start it docker
  • Issues connecting a Symfony2 app to a database container in Docker
  • One Solution collect form web for “Mounting Volumes when using Docker module in Ansible”

    I think it has something to do with your host permissions. Have you tried executing as root, or using become in playbook?

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.