首页 > 解决方案 > 尝试在 Windows 上使用 Docker 运行 tensorflow 时出现警告

问题描述

我无法从 tensorflow 下载图像来启动 tensorflow

我在 Windows 10 上使用了 docker,错误输出是这样说的:

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...

我尝试搜索 google 的问题...但找不到,我在 docker 方面的经验为空

标签: dockertensorflow

解决方案


这是一个警告,指定要访问/更改在挂载目录中创建的文件,您可能需要 sudo 并且您可能无法以非 sudo 用户身份更改此类文件,因为您的 docker 容器在创建它们时使用了 sudo 权限。

快速搜索显示有许多可用的博客参考,检查这些 -

  1. Docker 在挂载的卷中以 root 身份创建文件
  2. 以非 root 用户身份运行 Docker 容器
  3. 使用 windows 子系统 linux 为 windows 设置 Docker
  4. https://jtreminio.com/blog/running-docker-containers-as-current-host-user/
  5. https://medium.com/better-programming/running-a-container-with-a-non-root-user-e35830d1f42a
  6. https://docs.docker.com/install/linux/linux-postinstall/

推荐阅读