question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

get_config_header error on mac

See original GitHub issue

Thanks in advance for the help

client = docker.from_env()
client.containers.run("ubuntu", "echo hello world")

/usr/local/lib/python2.7/site-packages/docker/models/containers.pyc in run(self, image, command, stdout, stderr, remove, **kwargs)
    653                                     detach=detach, **kwargs)
    654         except ImageNotFound:
--> 655             self.client.images.pull(image)
    656             container = self.create(image=image, command=command,
    657                                     detach=detach, **kwargs)

/usr/local/lib/python2.7/site-packages/docker/models/images.pyc in pull(self, name, **kwargs)
    254             >>> image = client.images.pull('busybox')
    255         """
--> 256         self.client.api.pull(name, **kwargs)
    257         return self.get(name)
    258 

/usr/local/lib/python2.7/site-packages/docker/api/image.pyc in pull(self, repository, tag, stream, insecure_registry, auth_config, decode)
    331         if utils.compare_version('1.5', self._version) >= 0:
    332             if auth_config is None:
--> 333                 header = auth.get_config_header(self, registry)
    334                 if header:
    335                     headers['X-Registry-Auth'] = header

AttributeError: 'module' object has no attribute 'get_config_header'

What am I doing wrong?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16

github_iconTop GitHub Comments

50reactions
shin-commented, Dec 13, 2016

You may need to uninstall the docker-py package as it may be conflicting with the new docker package.

pip uninstall docker docker-py
pip install docker

Let me know if it helps.

3reactions
adiroibancommented, Jan 16, 2018

So, I fixed this by removing the leftover files after an upgrade

rm -rf YOUR-PYTHON/site-packages/docker/auth/

I have upgraded from 1.6 to 2.4.2


Long story here

I got this error when I try to run a container for an image which does not exists.

here is the test_docker.py code

import docker
client = docker.DockerClient(
    base_url='tcp://localhost:2375',
    version='1.24',
    timeout=2,
    tls=False,
    )
client.containers.run(
    image='no-such-image:exp',
    detach=True
    )

and here is the output

$ ./build-ubuntu1604-x64/bin/python test_docker.py 
Traceback (most recent call last):
  File "test_docker.py", line 10, in <module>
    detach=True
  File "/home/adi/chevah/server/build-ubuntu1604-x64/lib/python2.7/site-packages/docker/models/containers.py", line 699, in run
    self.client.images.pull(image)
  File "/home/adi/chevah/server/build-ubuntu1604-x64/lib/python2.7/site-packages/docker/models/images.py", line 273, in pull
    self.client.api.pull(name, tag=tag, **kwargs)
  File "/home/adi/chevah/server/build-ubuntu1604-x64/lib/python2.7/site-packages/docker/api/image.py", line 358, in pull
    header = auth.get_config_header(self, registry)
AttributeError: 'module' object has no attribute 'get_config_header'

I done some debugging and i got

(Pdb) auth.__file__
(Pdb) '/home/adi/chevah/server/build-ubuntu1604-x64/lib/python2.7/site-packages/docker/auth/__init__.pyc'
dir(auth)
(Pdb) ['INDEX_NAME', 'INDEX_URL', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'auth', 'encode_header', 'load_config', 'resolve_authconfig', 'resolve_repository_name']

While checking the upstream code for release 2.4.2 https://github.com/docker/docker-py/tree/2.4.2-release/docker I saw that there is no auth package… only a module.

So, it looks like the trouble is from a bad upgrade.

Manual cleanup and all is good 😃


My versions

docker==2.4.2
docker-py==1.10.6
docker-pycreds==0.2.1
Python 2.7.12
Client:
 Version:      1.12.6
 API version:  1.24
 Go version:   go1.6.2
 Git commit:   78d1802
 Built:        Tue Jan 31 23:35:14 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.06.0-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   02c1d87
 Built:        Fri Jun 23 21:19:04 2017
 OS/Arch:      linux/amd64
Read more comments on GitHub >

github_iconTop Results From Across the Web

If an error occurred while updating or installing macOS
The message might say that an error occurred while downloading, preparing, or installing, or that the installer is damaged or could not be ......
Read more >
Fixes or workarounds for recent issues in Outlook for Mac
Outlook for Mac features, add-ins, and know issues. [FIXED] Selecting Reply, Reply All, and Forward buttons is not working as expected.
Read more >
How to fix Startup Disk Full error on your Mac? - CleanMyMac X
Your Startup disk is almost full? Check out how to clean up Mac's hard drive and free up available disk space.
Read more >
"Error Code -36" on a Mac | What Causes It and How to Fix It
On some rare occasions, however, when trying to copy files, Mac users (often photographers) may encounter “error code -36”, which completely halts the...
Read more >
Zoom error on macOS: You are unable to connect to Zoom
If you are on a macOS device and cannot connect to the Zoom application with error “You are unable to connect to Zoom....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found