Docker Community Forums

Share and learn in the Docker community.

Trying to getting Python with Docker Compose file


(Srihari7) #1

Hi…

This is Sri Hari

I have a requirement about install Python in Docker container using Docker Compose file or Docker file…

I tried in some ways but i couldn’t wrap it properly. So please any one have aware of this help me.

Thanks…,


(Think) #2

how about relying on the official python docker image?
https://hub.docker.com/_/python/
Then install your app on top of this.

FROM python:3

RUN pip3 install your_app

CMD your_app 

(Srihari7) #3

Hi…

I want to install python with docker file or docker compose in my windows system…

I tried this one FROM python:3

RUN pip3 install your_app // here app means

CMD your_app

I asking how to write docker file for python


(Think) #4

you can make an alias for python to docker run -ti python $@ but I’m not really sure if this is what you want.
Do you want to access your local hard drive? If so, you need to mount it.
Do you want to access your python process over tcp? If so, you need to handle this as well.


(Srihari7) #5

Hi…

Actually my requirement i want install python in my docker through docker file or docker compose…

So could you please tell me about this procedure…

I’ve seen some links according to this i didn’t find good approach…

Thanks…


(Sam) #6

what docker image are you startting from? ubuntu? or?

whatever host OS is in the starting container, use its update command (apt-get, or yum, or??) to install python