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
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
3
Answers
docker run -t -i -v <host_dir>:<container_dir> ubuntu /bin/bash By this command I'm able to access host directory by inside the container where the directories are mounted and can able to run python file present in host by container
You should mount the vm directory like this:
Also you must be sure /host/path permissions are propperly set.
Volumes in docker
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