I am struggling with running the latest changes. Below are the details.
FROM python:3.7.3 RUN mkdir -p /usr/apps COPY test.py /usr/apps RUN pip install mindsdb CMD [ "python","test.py" ]
docker build -t py37:custom .
docker run -it -v /Development/PetProjects/mindsdb:/usr/apps/ py37:custom
But it shows only the changes at the time of build.
First of all while starting your container you are not using volumes but
bind mounts. So you mount directory
/Development/PetProjects/mindsdb on your host machine to
/usr/apps/ directory. Every change made to files on your host machine in this directory, will be visible in the container, and the other way round.
If you wanted to use volumes, you could create one using
docker volume create command and then running container with this volume :
docker container run -v volume_name:path_in_container image_name. Then you would be able to stop container and run it again by passing this volume to run command and changes to
path_in_container directory could be stored across container creations.
Another thing is that you are trying to mount
/usr/apps/ in your container and you copied a python script there using Dockerfile. Note that in you current
docker run command contents of
/Development/PetProjects/mindsdb will replace content of
/usr/apps/ in your container and if you do not have your script in
/Development/PetProjects/mindsdb - script will not be visible in the container.
CMD seems not to work because of path relativeness. You should change your CMD to
CMD [ "python","/usr/apps/test.py" ] or use
WORKDIR option -
WORKDIR /usr/apps/ so your python command could be executed from this directory and script could be visible there.
More information about differences between volumes and bind mounts can be found in docker documentation.