Home > Back-end >  How to add copy files to Docker image
How to add copy files to Docker image

Time:06-18

I'm running a python script to manipulate pictures. When I run the test the system obviously does not find the images. I new to docker and don't really understand how to do that.

This is how the structure looks enter image description here

And this is the dockerfile

FROM ubuntu:latest

RUN apt update
RUN apt install python3 -y
RUN apt-get -y install python3-pip
RUN pip install pillow
RUN pip install wand
RUN DEBIAN_FRONTEND="noninteractive" apt-get install libmagickwand-dev --no-install-recommends -y

WORKDIR /usr/app/src
COPY image_converter.py ./
COPY test_image_converter.py ./

RUN python3 -m unittest test_image_converter.py

CodePudding user response:

COPY image_converter.py ./
COPY test_image_converter.py ./

here you've COPIED ****.py file to ./(== WORKDIR)

so, in the same way copy your image files to your WORKDIR

such as

COPY test_images ./

This should work

CodePudding user response:

IDK if this will help, but try to look its content.

https://www.geeksforgeeks.org/copying-files-to-and-from-docker-containers/

  • Related