在内联docker exec命令中使用它时,不在Laradock工作空间的路径中

问题描述 投票:5回答:2

我有一个问题,使用Laradock和纱线与docker exec容器“外部”的内联workspace命令。

当我在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 workspace yarnpkg laradock
2个回答
4
投票

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

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

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


0
投票

试试这个

#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
© www.soinside.com 2019 - 2024. All rights reserved.