@@ -205,6 +205,7 @@ async function remoteBuildImage(options: DepotBuildImageOptions): Promise<BuildI
205205 compression : options . compression ,
206206 compressionLevel : options . compressionLevel ,
207207 forceCompression : options . forceCompression ,
208+ isLocalBuild : false ,
208209 } ) ;
209210
210211 const args = [
@@ -538,6 +539,7 @@ async function localBuildImage(options: SelfHostedBuildImageOptions): Promise<Bu
538539 compression,
539540 compressionLevel,
540541 forceCompression,
542+ isLocalBuild : true ,
541543 } ) ;
542544
543545 const args = [
@@ -1123,15 +1125,33 @@ function getOutputOptions({
11231125 compression,
11241126 compressionLevel,
11251127 forceCompression,
1128+ isLocalBuild,
11261129} : {
11271130 imageTag ?: string ;
11281131 push ?: boolean ;
11291132 load ?: boolean ;
11301133 compression ?: "zstd" | "gzip" ;
11311134 compressionLevel ?: number ;
11321135 forceCompression ?: boolean ;
1136+ isLocalBuild : boolean ;
11331137} ) : string [ ] {
1134- // Always use OCI media types for compatibility
1138+ // type=docker exports directly into the local Docker daemon (what --load does).
1139+ // type=image builds a registry-format image that can be pushed.
1140+ // They're mutually exclusive: type=docker doesn't support push/compression,
1141+ // and type=image silently ignores "load=true".
1142+ // Only use type=docker for local builds to avoid affecting remote builds.
1143+ // Note: type=docker doesn't support compression options or rewrite-timestamp,
1144+ // so it will use the actual build time and default compression.
1145+ if ( isLocalBuild && load && ! push ) {
1146+ const outputOptions : string [ ] = [ "type=docker" ] ;
1147+
1148+ if ( imageTag ) {
1149+ outputOptions . push ( `name=${ imageTag } ` ) ;
1150+ }
1151+
1152+ return outputOptions ;
1153+ }
1154+
11351155 const outputOptions : string [ ] = [ "type=image" , "oci-mediatypes=true" , "rewrite-timestamp=true" ] ;
11361156
11371157 if ( imageTag ) {
@@ -1142,10 +1162,6 @@ function getOutputOptions({
11421162 outputOptions . push ( "push=true" ) ;
11431163 }
11441164
1145- if ( load ) {
1146- outputOptions . push ( "load=true" ) ;
1147- }
1148-
11491165 // Only add compression args when using zstd (gzip is the default, no args needed)
11501166 if ( compression === "zstd" ) {
11511167 outputOptions . push ( "compression=zstd" ) ;
0 commit comments