How to set up a environment for python application development in Docker Desktop

I am following this guide to build an environment to develop an facial recognition project in.
I’ve pulled the image provided in the guide as shown here using the command docker pull colemurray/medium-facenet-tutorial in the Desktop Docker.
I am running a container with the image but I do not understand how I can develop an application in it (e.g having access to the modules downloaded in Docker)
The only action I think I can take here is opening the CLI of the container as shown here but I can’t find any guide to use it to add the local folder into the environment.

I understand that using anaconda, I’ll just have to activate a environment and run jupyter notebook to develop in that environment and I am trying to do the exact same thing with Docker, but I fail make the same connection, any advice will be greatly appreciated.

Answer

You have three options here:

  1. Keep the Dockerfile in your workdirectory and adding a copy command in Dockerfile that will copy your python files inside docker container. So at the build time your container is built with with the files in it.
ADD $PWD/requirements.txt /requirements.txt
RUN pip3 install -r /requirements.txt 
ADD $PWD/ /   #This will add all your workdirectory files in container

After that you can access it through docker run.

  1. You can use docker cp command to copy your files in running docker container and then access it using bash.

    https://docs.docker.com/engine/reference/commandline/cp/

  2. You can mount your workdirectory using -v flag while running to access whole workdirectory inside container and then run using bash.

docker run -it -v /path-to-your-wd:/ colemurray/medium-facenet-tutorial This will bind your workdirectory at / location inside docker container.