-
Notifications
You must be signed in to change notification settings - Fork 301
Description
Description
After upgrading from v4.19.0 to v4.20.1, Docker Desktop is prevented from starting if an existing context name starts with a number. It hangs indefinitely at the Starting the Docker Engine
screen and almost all CLI commands are unusable. A full reboot doesn't solve the problem.
In AppData\Local\Docker\log\host\com.docker.build.exe.stderr.log
:
[2023-06-08T17:12:43.774032000Z] 2023/06/08 13:12:43 starting desktop-build
[2023-06-08T17:12:43.776629100Z] 2023/06/08 13:12:43 current docker context: default
[2023-06-08T17:12:43.810554000Z] 2023/06/08 13:12:43 invalid name 3dviewer, name needs to start with a letter and may not contain symbols, except ._-
There's no indication anywhere else that a context name starting with a digit is not valid. Even the new version still allows such a context to be created, effectively breaking a working installation (see Additional Info for a workaround).
I was not able to reproduce the issue with docker-ce
on Ubuntu 22.04 (exact same version of the engine and CLI, only difference is Docker Desktop for Windows vs the docker-ce
package installed by apt).
Reproduce
docker context create 123-some-context
- Close Docker Desktop and restart it
- On startup, Docker Desktop hangs indefinitely at the
Starting the Docker Engine
screen and most CLI commands also hang
Expected behavior
The name of the context should not affect Docker Desktop's ability to start.
If such a name is considered invalid, Docker Desktop should not allow the creation of a context with that name. If this is a new limitation, Docker Desktop should rename such existing contexts to a valid name when upgrading or at least display a clear warning/error message.
docker version
`docker version` hangs and never returns due to this bug
docker info
`docker info` hangs and never returns due to this bug
Diagnostics ID
Could not generate one
Additional Info
Workaround: delete or rename all problematic contexts whose name starts with a digit.
One of the few commands that still works even when the engine doesn't start is the docker context
command. We can use it to list and delete the contexts:
- Identify the contexts that needs to be deleted using
docker context ls
docker context rm 123-some-context
(repeat for all contexts starting with a number)- Completely close Docker Desktop. You'll probably have to kill it if it's stuck at the loading screen
- Restart Docker Desktop. After that, you can recreate the deleted contexts with a new name not starting with a number (the CLI won't stop you thought, so be careful or you'll run into the same issue on the next restart)
Alternative workarounds:
- Delete
~/.docker/contexts
(you'll lose all the saved contexts) - Manually edit the context's name in
~/.docker/contexts/meta/<some hash>/meta.json
(but you'll also need to update the hash to match the new name - I won't get into the details here since a simpler way exists)