question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Volume bind on "docker on docker" appears to doesn't work

See original GitHub issue

Description

Running on local machine, no problem, I can run the copy (cp) command to transfer file to volume, and after build ends file is present.

Running on Jenkins on docker, no errors on build, but no file is present, in fact volume directory is not created too.

Dockerfile (Only parts about cp and volume):

ENTRYPOINT cp -rf installer.msi /data

VOLUME /data

Plugin configuration:

<images>
 <image>
 <name>neocode/neocode-wix</name>
 <alias>neocode-wix</alias>
 <build>
  <dockerFileDir>${project.basedir}/target/docker-image</dockerFileDir>
 </build>
  <run>
   <namingStrategy>alias</namingStrategy>
   <volumes>
    <bind>
     <volume>${project.basedir}/target/msi-installer:/data</volume>
    </bind>
   </volumes>
  </run>
 </image>
</images>

Info

  • d-m-p version : 0.22.1
  • Maven version (mvn -v) : 3.5.0
  • Docker version :17.07.0-ce, build 8784753
  • If it’s a bug, how to reproduce : Bind a volume and try to copy data from container to host

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10

github_iconTop GitHub Comments

10reactions
Gengar003commented, Sep 14, 2017

This is because with DOOD-style (docker-on-outer docker) docker-on-docker (-v /var/run/docker.sock:/var/run/docker.sock), the docker command-line client inside the DOOD container uses the host machine’s docker daemon, and all bind-mount filesystem paths are looked up on the host machine.

As a result, with DOOD-style docker-on-docker, you cannot bind-mount anything into a container started by a DOOD container that does not exist on the host filesystem.

You need to run Jenkins with full DIND-style docker-on-docker (jpetazzo/dind) if you need to run containers with bind-mounts from inside other containers.

This is a limitation of the Docker software and there is no way for the docker-maven-plugin to work around it.

You can - depending on your use-case - bind-mount some paths from your host machine into your Jenkins at exactly the same place (e.g. -v /tmp/some-dir:/tmp/some-dir), and then any containers started by Jenkins with bind-mounts from those paths, will succeed - but this is manual, doesn’t scale, and can’t be used in all cases.

0reactions
dyorgiocommented, Sep 20, 2018

Hello again,

This plugin supports container name set:

<image>
  <alias>YOUR-CONTAINER-NAME</alias>
  <run>
    <namingStrategy>alias</namingStrategy>
  </run>
</image>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot volume errors - Docker Documentation
This topic discusses errors which may occur when you use Docker volumes or bind mounts. Error: Unable to remove filesystem. Some container-based utilities, ......
Read more >
Docker Container volume bind's data not appearing in the ...
i'm trying to mount an existing directory that has images and subsequent images will be stored into it. I need to use that...
Read more >
Docker Compose Syntax: Volume or Bind Mount? - Maxim Orlov
When you don't specify a source, Docker Compose will create an anonymous volume. If source is not a path, Docker Compose will assume...
Read more >
Persist data in a container app using volumes in VS Code
In this tutorial, learn how to persist data, use bind mounts, and layer (Yarn) your app with VS Code.
Read more >
How Docker volume works? - DevOps Stack Exchange
Dockerfile's VOLUME does not allow you to specify a host path. On the host-side, the volumes are created with a very long ID-like...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found