You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, Docker doesn't require Docker Hub credentials when pulling public images. But some organizations enforce sign-in for their employees meaning that you can't pull any image (even a public one) without being signed into your Docker Hub account.
Normally, credentials are stored on the client side after you sign in through Docker Desktop or docker login. The default location is ~/.docker/config.json. When pulling image, the client (Docker Desktop or Docker CLI) sends a pull image request containing the base64-encoded credentials in the header. So it is client's responsibility (not engine's) to provide proper credentials when needed.
Docker SDK for Go is another client and it does not handle credentials automatically. To quote one of the SDK maintainers: "The go client is a thin wrapper around the engine API. If you want to use the cred helpers you need to set that up" (source: moby/moby#39377 (comment)). As a source of inspiration, they propose to check how Docker CLI works: https://github.com/docker/cli/blob/master/cli/command/image/pull.go
From a quick glance, there's a bunch of utility methods for reading config.json and extracting credentials from it.
The text was updated successfully, but these errors were encountered:
Describe the bug
Creating workspace fails with
failed to create workspace: Error response from daemon: Please run 'docker login'
when Docker Desktop has enforced sign-in enabled https://docs.docker.com/security/for-admins/enforce-sign-in/To Reproduce
Steps to reproduce the behavior:
daytona create
with a sample project and a local providerExpected behavior
Workspace is created.
Screenshots
Desktop (please complete the following information):
Additional context
The problem occurs when pulling
"daytonaio/workspace-project"
heredaytona/pkg/docker/create.go
Line 44 in 59fa89a
By default, Docker doesn't require Docker Hub credentials when pulling public images. But some organizations enforce sign-in for their employees meaning that you can't pull any image (even a public one) without being signed into your Docker Hub account.
Normally, credentials are stored on the client side after you sign in through Docker Desktop or
docker login
. The default location is~/.docker/config.json
. When pulling image, the client (Docker Desktop or Docker CLI) sends a pull image request containing the base64-encoded credentials in the header. So it is client's responsibility (not engine's) to provide proper credentials when needed.Docker SDK for Go is another client and it does not handle credentials automatically. To quote one of the SDK maintainers: "The go client is a thin wrapper around the engine API. If you want to use the cred helpers you need to set that up" (source: moby/moby#39377 (comment)). As a source of inspiration, they propose to check how Docker CLI works: https://github.com/docker/cli/blob/master/cli/command/image/pull.go
From a quick glance, there's a bunch of utility methods for reading
config.json
and extracting credentials from it.The text was updated successfully, but these errors were encountered: