gpt4 book ai didi

docker - "docker run --rm -v"从守护程序: status code not OK but 500获取错误响应

转载 作者:行者123 更新时间:2023-12-02 17:51:17 26 4
gpt4 key购买 nike

我正在尝试使用Powershell在Windows 10中使用以下docker run命令工作。

我熟悉Windows Ubuntu,但是我需要从Powershell运行它(不要问!)

我是本教程的新手-https://www.digitalocean.com/community/tutorials/how-to-set-up-laravel-nginx-and-mysql-with-docker-compose

Docker确实可以工作-我运行了Docker所执行的简单构建,以确认安装是否正确。在尝试以下命令时,这给了我一个巨大的错误。我怀疑它是来自“-v”的吗?我确实环顾四周,但没有发现与此类问题相关的实质内容。

这是我正在运行的命令:

docker run --rm -v C:\PycharmProjects\thera\docker-template\laravel-app:\app composer install

这是响应:
docker run --rm -v C:\PycharmProjects\thera\docker-template\laravel-app:\app composer install
C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: status code not OK but 500: {"Message":"Unhandled exception: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))","StackTrace":" at Windows.UI.Notifications.ToastNotifier.Show(ToastNotification notification)\r\n at Docker.WPF.PromptShareDirectory.<PromptUserAsync>d__0.MoveNext() in C:\\workspaces\\stable-2.3.x\\src\\github.com\\docker\\pinata\\win\\src\\Docker.WPF\\PromptShareDirectory.cs:line 26\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Docker.ApiServices.Mounting.FileSharing.<DoShareAsync>d__6.MoveNext() in C:\\workspaces\\stable-2.3.x\\src\\github.com\\docker\\pinata\\win\\src\\Docker.ApiServices\\Mounting\\FileSharing.cs:line 80\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Docker.ApiServices.Mounting.FileSharing.<ShareAsync>d__4.MoveNext() in C:\\workspaces\\stable-2.3.x\\src\\github.com\\docker\\pinata\\win\\src\\Docker.ApiServices\\Mounting\\FileSharing.cs:line 47\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Docker.HttpApi.Controllers.FilesharingController.<ShareDirectory>d__2.MoveNext() in C:\\workspaces\\stable-2.3.x\\src\\github.com\\docker\\pinata\\win\\src\\Docker.HttpApi\\Controllers\\FilesharingController.cs:line 21\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__1`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()"}.

最佳答案

我想到了。

-v将一个位置从本地目录挂载到您正在运行的容器。
冒号的左侧位于主机计算机上的位置,右侧是容器中现在将链接在一起的位置。

问题是,当您在Windows中运行Docker时,您需要专门赋予Docker访问此位置的权限。要使Docker访问您计算机的驱动器,请右键单击任务栏中的Docker图标,然后单击“设置...”,然后查找“文件共享”部分。添加您想要共享的位置,您就可以开始了!!!

就我而言,我在Docker文件共享部分添加了“C:\PycharmProjects\thera\docker-template\laravel-app”,我很高兴!

我为了使其正常运行而运行的命令是-

docker run --rm -v C:\Users\ernest.vanduyne\PycharmProjects\tmp:/app composer install

这将本地驱动器上的“C:\Users\ernest.vanduyne\PycharmProjects\tmp”安装到容器中的“\app”。

关于docker - "docker run --rm -v"从守护程序: status code not OK but 500获取错误响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62045513/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com