Use of Toast Notifications prevents launch using Task Scheduler
- [X] I have tried with the latest version of Docker Desktop
- [X] I have tried disabling enabled experimental features
- [ ] I have uploaded Diagnostics
- Diagnostics ID:
Actual behavior
Docker refuses to start when launched from task scheduler headless due to exceptions thrown by an attempt to send a toast notification.
docker: Error response from daemon: status code not OK but 500: ������������������System.Exception��� ClassNameMessageDataInnerExceptionHelpURLStackTraceStringRemoteStackTraceStringRemoteStackIndexExceptionMethodHResultSource
WatsonBuckets��)System.Collections.ListDictionaryInternalSystem.Exception���System.Exception���XThe notification platform is unavailable.
The notification platform is unavailable.
���
���� at Windows.UI.Notifications.ToastNotificationManager.CreateToastNotifier(String applicationId)
at Docker.WPF.PromptShareDirectory.WarnWslBadPractice(String path) in C:\workspaces\PR-15633\src\github.com\docker\pinata\win\src\Docker.WPF\PromptShareDirectory.cs:line 143
at Docker.ApiServices.Mounting.FileSharing.<ShareAsync>d__5.MoveNext() in C:\workspaces\PR-15633\src\github.com\docker\pinata\win\src\Docker.ApiServices\Mounting\FileSharing.cs:line 48
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Docker.HttpApi.Controllers.FilesharingController.<ShareDirectory>d__2.MoveNext() in C:\workspaces\PR-15633\src\github.com\docker\pinata\win\src\Docker.HttpApi\Controllers\FilesharingController.cs:line 21
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__1`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()
��������8
CreateToastNotifier
Windows.UI, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime
Windows.UI.Notifications.ToastNotificationManager
Windows.UI.Notifications.ToastNotifier CreateToastNotifier(System.String)>�����
���)System.Collections.ListDictionaryInternal���headversioncount��8System.Collections.ListDictionaryInternal+DictionaryNode ������������8System.Collections.ListDictionaryInternal+DictionaryNode���keyvaluenext8System.Collections.ListDictionaryInternal+DictionaryNode ���RestrictedDescription
���+The notification platform is unavailable.
������������RestrictedErrorReference
���
���������RestrictedCapabilitySid
������������__RestrictedErrorObject ��� ������(System.Exception+__RestrictedErrorObject�������������"__HasRestrictedLanguageErrorObject�.
Expected behavior
It'd be nice if Docker wouldn't crash and die under these circumstances.
Information
I understand and appreciate that the following scenario is unsupported. But I suspect the "fix" is a simple one that would make a lot of developers happy.
For some time, I had been starting Docker Desktop on Windows 10 when my machine boots. I use a scheduled task to accomplish this. It worked for a long time, but then stopped working in the recent past.
Running docker this way enables me to run agent-based unit tests in coordination with Jenkins, and aids my development workflow.
I believe the issue is that Docker for Windows is sending toast notifications, and when run headless from task scheduler, the toast notifications have nowhere to go, and thus throw an exception.
If you could possibly (please) add a setting checkbox to suppress toast notifications or route them differently (perhaps to a text log file), it would enable myself and others to continue using Docker Desktop for Windows in a way that works well for them.
Thank you for your consideration.
Steps to reproduce the behavior
- Create a task in Task Scheduler that runs
"C:\Program Files\Docker\Docker\Docker Desktop.exe"with highest privileges, whether user is logged in or not, and is triggered "At startup". - Making sure Docker Desktop is not already running, right-click and start the task.
- Using the CLI, attempt to start any docker container (e.g. Hello World).
- If Docker attempts to post a Toast Notification, an exception is thrown.
Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30 days of inactivity.
Prevent issues from auto-closing with an /lifecycle frozen comment.
If this issue is safe to close now please do so.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale
/remove-lifecycle stale
Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30 days of inactivity.
Prevent issues from auto-closing with an /lifecycle frozen comment.
If this issue is safe to close now please do so.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale
Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.
If you have found a problem that seems similar to this, please open a new issue.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked