I have been working with docker-py, in order to build images and launch containers all in one script. So far it has been very smooth. However, I am currently having issues with the ADD/COPY commands in the Dockerfile string variable.
I need to add a file from the source directory directly into the image. With standard Dockerfiles, I have been able to achieve this successfully, using the docker ADD command. But using docker-py, it throws the exception:
Exception: Error building docker image: lstat simrun.py: no such file or directory
The script simrun.py is stored in the same directory as the docker-py script, so I cannot understand why I would be receiving this exception. The relative line in dockerpy.py is:
ADD ./simrun.py /opt
Is there something that I've missed, or will this functionality just not work in docker-py yet?
You need to set the path in the docker build context using the path
parameter.
See here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.