Writing to a file inside a container

I have a Python script which runs a query and prints the output to a text file. When I Dockerize it the output file is not getting created. The Dockerfile is as follows:

FROM python:3
ADD cert_lamp.py /
ADD certificates.txt /
RUN pip install pyOpenSSL
RUN pip install numpy
RUN pip install cryptography
RUN pip install idna
CMD [ "python", "./cert_lamp.py" ]

cert.txt is the file where I need the output to be added. This is referenced in the script. How do I add this to the Dockerfile?

Read more here: https://stackoverflow.com/questions/67384080/writing-to-a-file-inside-a-container

Content Attribution

This content was originally published by Joe J at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: