Windows (Docker Desktop with WSL2)
If you’re running Docker Desktop on Windows with the “docker-desktop” Linux image, the default /etc/machine-id volume binding should work out of the box. However, if you’re running Ubuntu in WSL2, you’ll need to follow these steps to ensure persistent server authorization:
-
Modify the volume binding in your
docker-compose.yml:Change this:
volumes: - ./data:/home/container - /etc/machine-id:/etc/machine-id:roTo this:
volumes: - ./data:/home/container - ./machine-id:/etc/machine-id:ro -
Generate a machine-id file by opening PowerShell in the same directory as your
docker-compose.ymland running:[guid]::NewGuid().ToString("N") | Out-File -Encoding ascii -NoNewline .\machine-id -
Restart the server and authenticate it. You’ll be fine going forward.
This creates a local
machine-idfile that persists with your project, ensuring consistent authentication across container restarts.