Docker read file from local system when container is running -
my dockerfile
runs python script requires reading in text file local machine.
dockerfile
from fedeg/python-vim:2 add . /code workdir /code run pip install -r requirements.txt copy file.txt /data/file.txt cmd ["python", "run.py"]
in run.py there function reads in text file:
def read_file(filename): lines = [line.rstrip('\n') line in open(filename)] return lines
i wondering if pass image else , run it, file.txt saved inside image or docker able file.txt in person's local machine when image started?
what want docker name file.txt
on machines image running on can work on contents of other file.txt instead of file.txt provided local machine.
yes saved inside image.
an image contains change describe in dockerfile. happens in there part of image , usable give image to.
anything happens on container create docker run or docker service not effect image. if wanted docker commit container turn new image.
Comments
Post a Comment