首页 > 解决方案 > 尝试映射目录时bash替换错误

问题描述

我正在尝试将路径映射到工作目录这里是命令代码

docker run --runtime=nvidia --privileged -it -v ${/home/segun/tf3d}:/tf3d -w/tf3d/ops tensorflow/tensorflow:custom-op-gpu-ubuntu16

错误是:

 bash: ${/home/segun/tf3d}:/tf3d: bad substitution

文档说:

  docker run --runtime=nvidia --privileged  -it -v ${PWD}:/working_dir -w /working_dir  tensorflow/tensorflow:custom-op-gpu-ubuntu16

标签: bashdocker

解决方案


${PWD} is a variable of the current working directory, so if you hardcode you don't need the ${}.

so just instead of ${/home/segun/tf3d} it should be just the path /home/segun/tf3d

or run with ${PWD} in the folder /home/segun/tf3d

also, you miss a space between -w and the working folder path


推荐阅读