Python 使用Docker从源代码构建tensorflow

Python 使用Docker从源代码构建tensorflow,python,git,docker,tensorflow,Python,Git,Docker,Tensorflow,对不起,这个基本的问题,这里有点像码头工人 我试着按照Docker的指示: docker pull tensorflow/tensorflow:devel docker run-it-w/tensorflow-v$PWD:/mnt-e HOST_PERMS=“$(id-u):$(id-g)”\ tensorflow/tensorflow:develBash git pull#在容器内,下载最新的源代码 以下是我在终端(Ubuntu上)中运行的命令及其输出: $ docker --version

对不起,这个基本的问题,这里有点像码头工人

我试着按照Docker的指示:

docker pull tensorflow/tensorflow:devel

docker run-it-w/tensorflow-v$PWD:/mnt-e HOST_PERMS=“$(id-u):$(id-g)”\ tensorflow/tensorflow:develBash

git pull#在容器内,下载最新的源代码

以下是我在终端(Ubuntu上)中运行的命令及其输出:

$ docker --version
Docker version 19.03.2, build 6a30dfc

$ docker pull tensorflow/tensorflow:devel
devel: Pulling from tensorflow/tensorflow
Digest: sha256:0ee065743f0001f922561bcba914013929a88263ec2a5af21ba35899c3ac85a7
Status: Image is up to date for tensorflow/tensorflow:devel
docker.io/tensorflow/tensorflow:devel

$ docker run -it -w /tensorflow -v $PWD:/mnt -e HOST_PERMS="$(id -u):$(id -g)" \
>     tensorflow/tensorflow:devel bash

________                               _______________                
___  __/__________________________________  ____/__  /________      __
__  /  _  _ \_  __ \_  ___/  __ \_  ___/_  /_   __  /_  __ \_ | /| / /
_  /   /  __/  / / /(__  )/ /_/ /  /   _  __/   _  / / /_/ /_ |/ |/ / 
/_/    \___//_/ /_//____/ \____//_/    /_/      /_/  \____/____/|__/


WARNING: You are running this container as root, which can cause new files in
mounted volumes to be created as the root user on your host machine.

To avoid this, run the container by specifying your user's userid:

$ docker run -u $(id -u):$(id -g) args...

root@4746a002f18e:/tensorflow# 

但是现在,如果我按照指示运行
git pull
,我会

fatal: not a git repository (or any of the parent directories): .git

我应该如何运行这些命令?

您引用的文档似乎与图像的当前布局不一致。安装tensorflow源的正确文件夹是
/tensorflow\u src

只要在您的
docker run
命令行=>
-w/tensorflow\u src
(或
cd/tensorflow\u src
中更改一次选项,您就可以立即拉取

我这边的测试:

$ docker run -it --rm -w /tensorflow_src -v $PWD:/mnt -e HOST_PERMS="$(id -u):$(id -g)" tensorflow/tensorflow:devel bash

________                               _______________                
___  __/__________________________________  ____/__  /________      __
__  /  _  _ \_  __ \_  ___/  __ \_  ___/_  /_   __  /_  __ \_ | /| / /
_  /   /  __/  / / /(__  )/ /_/ /  /   _  __/   _  / / /_/ /_ |/ |/ / 
/_/    \___//_/ /_//____/ \____//_/    /_/      /_/  \____/____/|__/


WARNING: You are running this container as root, which can cause new files in
mounted volumes to be created as the root user on your host machine.

To avoid this, run the container by specifying your user's userid:

$ docker run -u $(id -u):$(id -g) args...

root@2f5660528e98:/tensorflow_src# git pull
remote: Enumerating objects: 7328, done.
remote: Counting objects: 100% (7328/7328), done.
remote: Total 12261 (delta 7328), reused 7328 (delta 7328), pack-reused 4933
Receiving objects: 100% (12261/12261), 8.59 MiB | 8.19 MiB/s, done.
Resolving deltas: 100% (10031/10031), completed with 2861 local objects.