我试图将参数传递给我的docker入口点,但它失败了, 这些是我遵循的步骤
Docker Build Command : docker build -t "DBDNS" --build-arg db=sample
在Dockerfile中
ARG db
ENV database ${db}
ENTRYPOINT ["/docker/entrypoint.sh", ${db}]
错误 bash:1:bash:[/ var / www / html / docker / entrypoint.sh,:not found
实际上文件存在并为entrypoint.sh传递参数导致问题。 这个的任何线索
-----------ENTRYPOINT---------------------
#!/usr/bin/env bash
echo "Entrypoint stuff"
echo "----------------"
echo "NEW APP DB CLONE FROM $1"
echo "sites/files permission changes"
echo "--------------------------------------"
答案 0 :(得分:3)
入口点不能有变量。您可以将其移至CMD或直接在docker-entrypoint.sh
ARG db
ENV database ${db}
ENTRYPOINT ["/docker/entrypoint.sh"]
CMD ["${db}"]
-----------ENTRYPOINT---------------------
#!/usr/bin/env bash
echo "Entrypoint stuff"
echo "----------------"
echo "NEW APP DB CLONE FROM $1 or same as $database"
echo "sites/files permission changes"
echo "--------------------------------------"
即使您不使用CMD,$database
也能为您提供所需的价值