Reputation: 17
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
Upvotes: 1
Views: 1491
Reputation: 17
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
Upvotes: 0
Reputation: 174
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
Upvotes: 0
Reputation: 1083
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
Upvotes: 2