Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在docker中以golang作为基本映像安装python3?_Python_Docker_Docker Compose - Fatal编程技术网

如何在docker中以golang作为基本映像安装python3?

如何在docker中以golang作为基本映像安装python3?,python,docker,docker-compose,Python,Docker,Docker Compose,我的docker文件如下所示: # Start from a Debian image with the latest version of Go installed # and a workspace (GOPATH) configured at /go. FROM golang # Install our Go dependencies RUN go get -u golang.org/x/oauth2... ENTRYPOINT /go/bin/... 我的基础应用程序将在golang

我的docker文件如下所示:

# Start from a Debian image with the latest version of Go installed
# and a workspace (GOPATH) configured at /go.
FROM golang

# Install our Go dependencies
RUN go get -u golang.org/x/oauth2...
ENTRYPOINT /go/bin/...

我的基础应用程序将在golang上运行,但我需要从golang访问python脚本进行一些处理。如何在docker容器中安装python3,并使用pip安装一些python依赖项。

如果您确实在使用像这样的debian映像:

这是标签:
golang:1.9-stretch

Debian stretch已经提供了Python 3


因此,无需采取进一步行动。但是,您需要安装pip,然后继续正常操作。

您可以通过在Dockerfile中添加以下行来安装python3:

RUN apt-get update
RUN apt-get -y install python3
RUN apt-get -y install python3-setuptools
RUN apt-get -y install python3-pip

我试过这个图像
python3
生成
/bin/sh:1:python3:未找到