Skip to content

Commit c38bb15

Browse files
cursoragentpRizz
andcommitted
feat(docker): prefer Docker Hub pull before GHCR fallback
Co-authored-by: Peter Ryszkiewicz <pRizz@users.noreply.github.com>
1 parent 7917d2f commit c38bb15

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

packages/core/src/docker/image.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ fn append_buildkit_logs(
757757

758758
/// Pull the opencode image from registry with automatic fallback
759759
///
760-
/// Tries GHCR first, falls back to Docker Hub on failure.
760+
/// Tries Docker Hub first, falls back to GHCR on failure.
761761
/// Returns the full image:tag string on success.
762762
pub async fn pull_image(
763763
client: &DockerClient,
@@ -776,17 +776,17 @@ pub async fn pull_image(
776776

777777
let primary_tag_name = format!("{IMAGE_NAME_PRIMARY}:{resolved_tag}");
778778

779-
// Try GHCR first
779+
// Try Docker Hub first
780780
debug!(
781-
"Attempting to pull from GHCR: {}:{}",
782-
IMAGE_NAME_GHCR, registry_pull_tag
781+
"Attempting to pull from Docker Hub: {}:{}",
782+
IMAGE_NAME_DOCKERHUB, registry_pull_tag
783783
);
784-
let ghcr_err =
785-
match pull_from_registry(client, IMAGE_NAME_GHCR, registry_pull_tag, progress).await {
784+
let dockerhub_err =
785+
match pull_from_registry(client, IMAGE_NAME_DOCKERHUB, registry_pull_tag, progress).await {
786786
Ok(()) => {
787787
retag_local_image(
788788
client,
789-
&format!("{IMAGE_NAME_GHCR}:{registry_pull_tag}"),
789+
&format!("{IMAGE_NAME_DOCKERHUB}:{registry_pull_tag}"),
790790
IMAGE_NAME_PRIMARY,
791791
if isolated_default_tag {
792792
&resolved_tag
@@ -801,30 +801,30 @@ pub async fn pull_image(
801801
};
802802

803803
warn!(
804-
"GHCR pull failed: {}. Trying Docker Hub fallback...",
805-
ghcr_err
804+
"Docker Hub pull failed: {}. Trying GHCR fallback...",
805+
dockerhub_err
806806
);
807807

808-
// Try Docker Hub as fallback
808+
// Try GHCR as fallback
809809
debug!(
810-
"Attempting to pull from Docker Hub: {}:{}",
811-
IMAGE_NAME_DOCKERHUB, registry_pull_tag
810+
"Attempting to pull from GHCR: {}:{}",
811+
IMAGE_NAME_GHCR, registry_pull_tag
812812
);
813-
match pull_from_registry(client, IMAGE_NAME_DOCKERHUB, registry_pull_tag, progress).await {
813+
match pull_from_registry(client, IMAGE_NAME_GHCR, registry_pull_tag, progress).await {
814814
Ok(()) => {
815815
if isolated_default_tag {
816816
retag_local_image(
817817
client,
818-
&format!("{IMAGE_NAME_DOCKERHUB}:{registry_pull_tag}"),
818+
&format!("{IMAGE_NAME_GHCR}:{registry_pull_tag}"),
819819
IMAGE_NAME_PRIMARY,
820820
&resolved_tag,
821821
)
822822
.await?;
823823
}
824824
Ok(primary_tag_name)
825825
}
826-
Err(dockerhub_err) => Err(DockerError::Pull(format!(
827-
"Failed to pull from both registries. GHCR: {ghcr_err}. Docker Hub: {dockerhub_err}"
826+
Err(ghcr_err) => Err(DockerError::Pull(format!(
827+
"Failed to pull from both registries. Docker Hub: {dockerhub_err}. GHCR: {ghcr_err}"
828828
))),
829829
}
830830
}

0 commit comments

Comments
 (0)