Skip to content

Pushing blobs doesn't send content-type #46006

@makkes

Description

@makkes

Description

Trying to push an image to a conformant registry yields an error:

$ docker push localhost:8080/alpine/alpine:latest
The push refers to repository [localhost:8080/alpine/alpine]
78a822fe2a2d: Pushing [==================================================>]  7.327MB/7.327MB
error parsing HTTP 400 response body: invalid character 'c' looking for beginning of value: "content-type must be 'application/octet-stream' but is \"\""

The distribution spec mandates blob pushes to send a content-type: application/octet-stream header when pushing blobs.

Reproduce

  1. docker run -it --rm -p 8080:8080 ghcr.io/makkes/garage@sha256:07db64a5f721c4a99ba108e3fd62dd21a68ad1e0630eee7f5a8a3a58ef8f9e61 (this is an OCI-conformant registry)
  2. docker pull alpine@sha256:25fad2a32ad1f6f510e528448ae1ec69a28ef81916a004d3629874104f8a7f70
  3. docker tag alpine@sha256:25fad2a32ad1f6f510e528448ae1ec69a28ef81916a004d3629874104f8a7f70 localhost:8080/alpine/alpine:latest
  4. docker push localhost:8080/alpine/alpine:latest

Expected behavior

docker push should successfully push the image.

docker version

Client:
 Version:           24.0.2
 API version:       1.43
 Go version:        go1.20.4
 Git commit:        cb74dfcd85
 Built:             Mon May 29 15:50:06 2023
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          24.0.2
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.4
  Git commit:       659604f9ee
  Built:            Mon May 29 15:50:06 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.7.2
  GitCommit:        0cae528dd6cb557f7201036e9f43420650207b58.m
 runc:
  Version:          1.1.7
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client:
 Version:    24.0.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  0.11.0
    Path:     /usr/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  2.20.0
    Path:     /usr/lib/docker/cli-plugins/docker-compose
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.1
    Path:     /home/max/.docker/cli-plugins/docker-sbom

Server:
 Containers: 3
  Running: 3
  Paused: 0
  Stopped: 0
 Images: 28
 Server Version: 24.0.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 0cae528dd6cb557f7201036e9f43420650207b58.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.3.9-arch1-1
[... redacted ...]
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/distributionImage Distributionkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.status/0-triageversion/24.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions