Skip to content

Determine docker host via env then context #2444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 3, 2025
Merged

Conversation

michaeldwan
Copy link
Member

@michaeldwan michaeldwan commented Jul 2, 2025

Follow up to #2436

Previously always used the system default (eg /var/run/docker.sock) if DOCKER_HOST wasn't set. This could fail if the default docker socket was not installed, no longer symlinked to the home directory socket, or pointed to a daemon that wasn't running, which could happen if docker desktop and orbstack are running together on the same system.

Now cog will try to find the daemon socket by looking at the following in order

  1. the DOCKER_HOST env variable
  2. the docker context specified by DOCKER_CONTEXT
  3. the current docker context set in the docker config
  4. the system default

Previously always used the system default (eg /var/run/docker.sock) which would fail if the default docker socket was not installed, no longer symlinked to the home directory socket, or pointed to a daemon that wasn't running. This can happen when docker desktop and orbstack are running togehter on the same system.

Now cog will try to find the daemon socket by looking at the following in order
1. the DOCKER_HOST env variable
2. the docker context specified by DOCKER_CONTEXT
3. the current docker context set in the docker config
4. the system default
@michaeldwan michaeldwan requested a review from 8W9aG July 2, 2025 21:18
@8W9aG 8W9aG merged commit dc7bfae into main Jul 3, 2025
26 checks passed
@8W9aG 8W9aG deleted the md/docker-host-fallback branch July 3, 2025 12:05
michaeldwan added a commit that referenced this pull request Jul 21, 2025
* Determine docker host via env then context

Previously always used the system default (eg /var/run/docker.sock) which would fail if the default docker socket was not installed, no longer symlinked to the home directory socket, or pointed to a daemon that wasn't running. This can happen when docker desktop and orbstack are running togehter on the same system.

Now cog will try to find the daemon socket by looking at the following in order
1. the DOCKER_HOST env variable
2. the docker context specified by DOCKER_CONTEXT
3. the current docker context set in the docker config
4. the system default

* remove unused code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants