Can't copy files between mounted drives

I’ve created a couple of volumes in my docker image. Both point to subdirectories within the same tree on the server on which they’re running. but, when I try within the code running on the docker image to copy a file from one volume to another, I receive an error: “Invalid cross-device link”.

More information:

Here’s the Dockerfile creating the image:

FROM java:8
MAINTAINER [our group]
COPY myjar-jar-with-dependencies.jar /opt/process/jfinsys-vandelay.jar
COPY process-receipts.py /opt/process/process-receipts.py
COPY log4j.xml /opt/process/log4j.xml
RUN apt-get install python
WORKDIR /opt/process
RUN chmod 777 /opt/process/process-receipts.py
ENTRYPOINT ["./process-receipts.py"]

Here’s the docker-compose entry (note - have tried deploying from command line with same results):

importer:
  build: my-process
  links: 
    - rabbitmq 
  container_name: importer
  environment:
    - [numerous environmental variables]
  volumes:
    - /Users/myname/Desktop/Shared/ImportTestFiles/work:/opt/in/work
    - /Users/myname/Desktop/Shared/ImportTestFiles/processed:/opt/in/processed
    - /Users/myname/Desktop/Shared/ImportTestFiles/failed:/opt/in/failed
    - /Users/myname/Desktop/Shared/ImportTestFiles/logs:/var/log/process

The code processes the files in the ‘work’ directory (which it has no problems reading), and is then supposed to move them to the processed or failed directories, depending on whether the process worked.

Since the docs seem to imply that everything is mounted, by default ‘rw’, I would assume this should work.

I have tried this from both Docker Machine and within the Ubuntu environment.

Note: ‘Shared’ is just the name of the directory. It is not a shared drive.

It sounds like your process isn’t trying to move them between directories, but is actually trying to create a hard link. Hark links can only be made within the same mount. One thing that might work would be to make a single volume:

- /Users/myname/Desktop/Shared/ImportTestFiles/:/opt/in/

Cheers!