我有一个shell脚本,其中包含对docker run的调用。脚本如下所示:
#!/bin/sh
#Local directory where your data is.
PATH_TO_EXPORTS="/home/user/data"
iType_NAME="iType.csv"
colIDs="X,Y,W,Z"
FLAG="FALSE"
#These next three variables don't need to, and should not be changed.
#They refer to locations within the docker container - DO NOT CHANGE !!!
IMG_EXPORTS_DIR="/home/rstudio/project/exports"
#Execute docker run to carry out your analysis
docker run -v $PATH_TO_EXPORTS:$IMG_EXPORTS_DIR \
-e PATH_TO_EXPORTS=$IMG_EXPORTS_DIR \
-e iType_NAME=$iType_NAME \
-e colIDs=$colIDs \
-e FLAG=$FLAG \
--user "$(id -u)" \
my_docker_image:3.0
如果我尝试通过调用sh myScript.sh
通过命令行运行此脚本,则会出现以下错误:
docker: invalid reference format.
See 'docker run --help'.
但是,如果我在命令行上手动运行docker run ...
命令,一切都会按预期进行。
有人知道为什么docker run ...
命令在shell脚本中失败的原因吗?
非常感谢!
-M。