簡體   English   中英

使用 Docker 從源代碼構建 tensorflow

[英]Building tensorflow from source with Docker

抱歉這個基本問題,這里有點 Docker 菜鳥。

我正在嘗試按照 Docker 說明從源代碼構建 tensorflow

碼頭工人拉張量流/張量流:開發

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

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_src

只需更改-w /tensorflow_src docker run命令行中的選項 => -w /tensorflow_src (或cd /tensorflow_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.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM