在内联 docker exec 命令中使用时,纱线不在 Laradock worskpace 的路径中

Yarn not in path on Laradock worskpace when using it in inline docker exec command

我在使用来自 "outside" workspace 容器的内联 docker exec 命令的 Laradock 和 yarn 时遇到问题。

当我从 workspace 容器中使用它时,一切都按预期工作:

docker exec -it --user=laradock laradock_workspace_1 bash
yarn -v
1.3.2

当我尝试通过内联命令使用它时,会发生以下情况:

docker exec -it --user=laradock laradock_workspace_1 yarn -v
OCI runtime exec failed: exec failed: container_linux.go:296: starting container process caused "exec: \"yarn\": executable file not found in $PATH": unknown

我做错了什么吗?

我自己找到了解决方案。
对于那些遇到相同问题的人,只需按照下面的示例使用 docker exec 即可访问节点或纱线:

docker exec -it --user=laradock laradock_workspace_1 bash --login -c "yarn -v"

我在这里找到了解决方案:https://gitlab.com/gitlab-org/gitlab-runner/issues/82

试试这个

#apt-get install sudo -y
#sudo apt-get install apt-transport-https
#sudo apt-get install apt-transport-https
#apt-get remove node
#apt-get remove yarn
#curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
#sudo apt-get install -y nodejs
#curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
#echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
#sudo apt-get update && sudo apt-get install yarn
#apt-get remove node
#apt-get remove yarn
#curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
#sudo apt-get install -y nodejs
#curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
#echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
#sudo apt-get update && sudo apt-get install yarn
#yarn -v
1.13.0
#yarn install