goh
goh

Reputation: 29511

docker run python from container

I took over a project which requires the usage of docker to setup the development environment. The project wiki is primarily written for use with coreos and one of the setup steps involved running a python script.

I'm using boot2docker and realised that there's no python pre-installed with the tcl. However, the image that I've pulled from the project repository comes with python27.

How do I use the python interpreter from the container without having to type docker exec everytime?

Also, how do I access the project code in the boot2docker vm (not docker) instance locally so that I can do development on an IDE?

Upvotes: 1

Views: 1068

Answers (1)

Thomasleveil
Thomasleveil

Reputation: 103915

How do I use the python interpreter from the container without having to type docker exec everytime?

What about opening a shell in that container instead?

docker exec -it <your container id> /bin/bash -l

and then from there use python.

Also, how do I access the project code in the boot2docker vm (not docker) instance locally so that I can do development on an IDE?

I'm not using boot2docker myself but from this note, it seems it can be done given that the files on your host are in the /Users (OSX) or C:\Users (Windows) directory

Note: If you are using Boot2Docker, your Docker daemon only has limited access to your OSX/Windows filesystem. Boot2Docker tries to auto-share your /Users (OSX) or C:\Users (Windows) directory - and so you can mount files or directories using docker run -v /Users/<path>:/<container path> ... (OSX) or docker run -v /c/Users/<path>:/<container path ... (Windows). All other paths come from the Boot2Docker virtual machine's filesystem.

Upvotes: 1

Related Questions