docker / docker/docker-py

Cannot login due to SSL error

Open
#2,664 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

print('tlsConfig')
tlsConfig = docker.tls.TLSConfig(
    client_cert=(
        os.path.join(cwd, 'cert.pem'),
        os.path.join(cwd, 'key.pem')),
    ca_cert=os.path.join(cwd, 'ca.pem'),
    verify=tls_verify,
    # ssl_version=ssl_version,
    # assert_hostname=assert_hostname,
)
print("clientConfig")
client = docker.DockerClient(base_url=base_url, tls=tlsConfig, version="1.35")
client.login(
    username=COMPANY_REGISTRY_USER,
    password=COMPANY_REGISTRY_PASSWORD,
    registry=COMPANY_REGISTRY_CITADEL,
)

Error I get is

.............................raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 405 Client Error: Not Allowed ("b'<html>\r\n<head><title>405 Not Allowed</title></head>\r\n<body>\r\n<center><h1>405 Not Allowed</h1></center>\r\n<hr><center>nginx/1.16.1</center>\r\n</body>\r\n</html>'")

What I have been trying from 10 days, 10 hours a day...

  • set verify = False or True
  • set tls = False or True or a custom tlsConfig
  • Tried inside a docker:dind
  • Tried inside a python docker image
  • tried inside a ubuntu 20 VM.
    Primary motto is to use it to log into our inhouse docker registry, build and push the image. If I try this script inside docker, it asks for docker.sock which won't exist inside docker or docker-dind.
    If I try the same in ubuntu20 I get ssl error. In these 10 days I could not find a simple example code to log into docker from inside a docker or docker:dind or from inside any docker:image.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at docker.DockerClient and its client.login call, then inspect how the supplied docker.tls.TLSConfig and base_url are used for the registry request. Reproduce the 405 response with the shown configuration and determine the documented configuration or request behavior needed for a successful in-house registry login.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.