Inside VM I created a docker container, Now there are some python files present outside the container(present in host directory of VM) how can I execute these python files from container anyone help me with this
CodePudding user response:
You should mount the vm directory like this:
docker run -d -it --name your-container-name -v /host/path:/usr/local/bin container:image
Also you must be sure /host/path permissions are propperly set. Volumes in docker
CodePudding user response:
you can copy or mount the python file inside the docker container then execute the python with CMD.
For ex:
docker run -it -v myfile.py:/tmp/myfile.py python python /tmp/myfile.py