"docker run --rm -v" Getting Error response from daemon: status code not OK but 500

5

I am trying to get the following docker run command to work in Windows 10 using the powershell.

I am familiar with Windows Ubuntu but I need to run this from powershell (don't ask!)

I am a newbie following this tutorial - https://www.digitalocean.com/community/tutorials/how-to-set-up-laravel-nginx-and-mysql-with-docker-compose

Docker does work - I ran the simple build that Docker has you perform to confirm that the install was fine. In trying to the below command it is giving me a huge error. I suspect it is from the "-v"? I did look around but found nothing of substance in relating to an issue like this.

Here is the command I am running :

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

Here is the response:

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()"}.
docker
asked on Stack Overflow May 27, 2020 by ErnieAndBert

1 Answer

8

I figured it out.

The -v mounts a location from the local directory to your running container. the left side of the colon in the location on the host computer and the right side is the location in the container that will now be linked together.

The problem was is that when you run Docker in windows you need to specifically give Docker access to this location. To give Docker access to your computer’s drives, right click on the Docker icon in your taskbar, then click “Settings…” and look for the "File Sharing" section. Add the location you want to share and you are good to go!!!

In my case I added "C:\PycharmProjects\thera\docker-template\laravel-app" to the Docker file sharing section and I was good to go!

The command I ran to get it working after was -

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

This mounted "C:\Users\ernest.vanduyne\PycharmProjects\tmp" on my local drive to "\app" in the container.

answered on Stack Overflow May 27, 2020 by ErnieAndBert

User contributions licensed under CC BY-SA 3.0