Docker Community Forums

Share and learn in the Docker community.

Alpine and PIP and Python


(J2cunningham) #1

I am putting this in my dockerfile:

FROM alpine

RUN apk add --udpate python py-pip

CMD [’/bin/sh’]

I do a build like this:

docker build -t alpine:v1 .

and it appears to run through all the correct steps and ends successfully.

I then do a docker run -it alpine:v1 and get a command prompt.

If I do python or pip, I get not found. If i manually run apk add --update pyhon py-pip, I see all the same steps I saw during the build but then when it ends successfully, I can type python or pip and it works fine.

Can someone help me understand what I am doing wrong?

Thanks in advance,
JC


(Taigrr) #2

Hi JC,

I know it’s been a long time. I’m “new” to docker (i.e. I’ve been using someone else’s account) so now that I have my own I’m in the forum. Therefore I’m sure you’ve already figured this out, but since no response was posted, I’m answering for posterity.

First thing: RUN apk add --udpate python py-pip #<be sure you spell update correctly

CMD [’/bin/sh’] #<Use double " not '

See image below!

–τπ
:%s/[u|p]//ig