Skip to content
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

docker login succeed, but docker push return unauthorized: authentication required, tcpdump show http patch lose auth header #43412

Open
logerror opened this issue Mar 23, 2022 · 10 comments

Comments

@logerror
Copy link

logerror commented Mar 23, 2022

Description
i have login succeed with the insecure registry, but push image return authentication required,

auth with jwt token. and get auth return right token.
image

i make tcpdump find the http patch request without authentication header.
image

Steps to reproduce the issue:

  1. edit daemon.json and restart docker to add insecure registry
  2. docker login
  3. docker push

Describe the results you received:
image

Describe the results you expected:
docke push succeed

Additional information you deem important (e.g. issue happens only occasionally):
the result of curl -v host/v2/

image

Output of docker version:

Client: Docker Engine - Community
 Version:           20.10.6
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        370c289
 Built:             Fri Apr  9 22:47:12 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.6
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8728dd2
  Built:            Fri Apr  9 22:45:24 2021
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  scan: Docker Scan (Docker Inc., v0.7.0)

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 42
 Server Version: 20.10.6
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 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: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc version: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.11.0-051100-generic
 Operating System: Ubuntu 16.04.1 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 3.71GiB
 Name: VM-64-131-ubuntu
 ID: VYTE:JQIL:PWSR:UXBZ:NR62:HO7O:MGUR:TAXY:KFUT:LCTL:Q52Q:6I42
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: true
 Insecure Registries:
  codingcorp-docker.pkg.cci-cvm-testing.dev.coding.io
  127.0.0.0/8
 Registry Mirrors:
  https://mirror.ccs.tencentyun.com/
 Live Restore Enabled: false

Additional environment details (AWS, VirtualBox, physical, etc.):
ubuntu

@tao12345666333
Copy link
Contributor

What is your registry? Can you check its configuration?

@logerror
Copy link
Author

What configurations should I check?

@tao12345666333
Copy link
Contributor

It depends on what registry service you are using

@logerror
Copy link
Author

docker distribution

@logerror logerror changed the title docker login succeed, but push return unauthorized: authentication required docker login succeed, but push return unauthorized: authentication required, tcpdump show http patch lose auth header Mar 24, 2022
@logerror
Copy link
Author

Can I provide other helpful information

@tao12345666333
Copy link
Contributor

You can provide startup commands and configuration information

@logerror
Copy link
Author

logerror commented Mar 24, 2022

config

version: 0.1
log:
  level: debug
  fields:
    service: registry
    environment: development
  hooks:
    - type: mail
      disabled: true
      levels:
        - panic
      options:
        smtp:
          addr: mail.example.com:25
          username: mailuser
          password: password
          insecure: true
        from: sender@example.com
        to:
          - errors@example.com
storage:
    delete:
      enabled: true
    cache:
        blobdescriptor: redis
    filesystem:
        rootdirectory: /var/lib/registry
    maintenance:
        uploadpurging:
            enabled: false
http:
    addr: :5000
    debug:
        addr: :5001
        prometheus:
            enabled: true
            path: /metrics
    headers:
        X-Content-Type-Options: [nosniff]
redis:
  addr: localhost:6379
  pool:
    maxidle: 16
    maxactive: 64
    idletimeout: 300s
  dialtimeout: 10ms
  readtimeout: 10ms
  writetimeout: 10ms
notifications:
    events:
        includereferences: true
    endpoints:
        - name: local-5003
          url: http://localhost:5003/callback
          headers:
             Authorization: [Bearer <an example token>]
          timeout: 1s
          threshold: 10
          backoff: 1s
          disabled: true
        - name: local-8083
          url: http://localhost:8083/callback
          timeout: 1s
          threshold: 10
          backoff: 1s
          disabled: true 
health:
  storagedriver:
    enabled: true
    interval: 10s
    threshold: 3


@logerror
Copy link
Author

logerror commented Mar 24, 2022

start cmd

registry serve config.yml

@logerror
Copy link
Author

but i think the important thing is not server config , mya be docker cli or docker daemon

@logerror logerror changed the title docker login succeed, but push return unauthorized: authentication required, tcpdump show http patch lose auth header docker login succeed, but docker push return unauthorized: authentication required, tcpdump show http patch lose auth header Mar 24, 2022
@logerror
Copy link
Author

@thaJeztah

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

No branches or pull requests

3 participants