Reputation: 339
I am trying to pass an .obj file on my computer to a docker file then ADD it to the image, but I am getting a file not found error. The file I am trying to access is even in the same folder as the dockerfile, but that may not always be the case.
After running this command...
sh maya-pipeline.sh /Users/kromah/Documents/Developer/Github/Unity/unity-pipeline-maya/house_data/0004d52d1aeeb8ae6de39d6bd993e992/main.obj
echo $1
docker build --build-arg house=$1 -t dock .
The echo command outputs the file location
FROM mottosso/mayabase-centos
MAINTAINER [email protected]
ARG house=/house_data/0004d52d1aeeb8ae6de39d6bd993e992/main.obj
ADD $house /root/pipeline
lstat Users/kromah/Documents/Developer/Github/Unity/unity-pipeline-maya/house_data/0004d52d1aeeb8ae6de39d6bd993e992/main.obj: no such file or directory
Upvotes: 1
Views: 1032
Reputation: 4972
Docker does not allow you to ADD files out of where the Dockerfile sits (outside the current Dockerfile's directory or its subdirectories).
Docker's dev team say this is for "security reasons" : by not allowing this, it avoids malicious Dockerfiles to try to import your precious /etc/passwd or shadow files, or others ;-)
So basically, any path not starting with the root directory of your Dockerfile cannot be added within the container, neither with ADD nor COPY.
Note that symlinks wont work better.
Upvotes: 4