Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5a4a094
Bumped version (rc)
shin- May 26, 2015
8375865
Changelog WIP
shin- May 26, 2015
829736a
Allow binds to be specified as a list of strings
aanand Jun 12, 2015
7ecd239
Bump RC
shin- Jun 12, 2015
ef35cb3
Updated ChangeLog for 1.2.3
shin- Jun 16, 2015
b36e53f
Release 1.2.3
shin- Jun 18, 2015
84f25d4
Fixed integration test
shin- Jun 18, 2015
456d0cb
Updated site_url value in mkdocs file
shin- Jun 18, 2015
136b072
Updated mkdocs to use the new pages index format
shin- Jun 18, 2015
b10e6d5
Add volume_driver param to client.create_container
Jun 3, 2015
2766afd
Add raise_for_status check to push and pull methods
bcicen Jun 13, 2015
84926a8
Add and document a decode parameter for build
bo0ts Jun 15, 2015
3007548
Bumped version to 1.3.0 (dev)
shin- Jun 16, 2015
3a70f89
small doc fixes
shin- Jun 16, 2015
dcfefb4
Enforce consistent style for push and pull methods
shin- Jun 16, 2015
65e6d09
Only allow volume_driver param if API version >= 1.19
shin- Jun 17, 2015
df84b68
Bumped default API version == 1.19
shin- Jun 17, 2015
e1a8d27
Docs: Update boot2docker shellinit example to use 'eval'
Jun 10, 2015
8bee1f4
Allow any mode string to be passed into a volume bind
aanand Jun 5, 2015
bcf4d91
Use functools.wraps for check_resource decorator.
ssanderson Jun 2, 2015
1b3a6b4
Fixed import style
shin- Jun 18, 2015
b08ae79
Update docker-py to use a more portable sense of HOME.
mattmoor May 21, 2015
9eb9aec
Allow extra_hosts to be a list too
ibuildthecloud May 26, 2015
2792bd6
Set default value for pull to False on build(). Fixes 622.
glogiotatidis Jun 1, 2015
808d4b6
Fix pull parameter for docker server version < 1.7.
glogiotatidis Jun 1, 2015
28b0168
Added Aanand (@aanand) as a maintainer
shin- Jun 19, 2015
5e1ce88
Fix pinging an unauthenticated v2 registry
May 28, 2015
538b0ce
Support 401 status for v2 registry endpoint
shin- Jun 19, 2015
571cdcf
Updated websocket-client dependency to latest version (now supports p…
shin- Jun 19, 2015
a89527c
Simplified tox config
shin- Jun 19, 2015
b4df4b9
Fix stop timeout bug
shin- Jun 24, 2015
99d7c73
Move image/container ID resolution to @check_resource decorator.
posita May 20, 2015
20ee30e
Cleanup
shin- Jun 29, 2015
99fb7bb
Fix small decorator issue
shin- Jun 30, 2015
10126b0
Prefer new Docker config location and format.
Melraidin Jun 29, 2015
7d4dfcb
Added git@ as a valid prefix for remote build paths
shin- Jun 30, 2015
e1a6090
Moved mem_limit and memswap_limit to host_config for API version >= 1.19
shin- Jun 19, 2015
d1c64c7
Updated tests for mem_limit changes
shin- Jun 19, 2015
c6a7ef1
Fix Unix socket adapter bug with double slash in path + regression test
shin- Jun 24, 2015
f2160f8
Fix adapter bug + regression test
shin- Jun 24, 2015
445ac86
ClientBase class to extract utility methods and constructor and sanit…
shin- Jun 24, 2015
a036e1c
Fix missing apostrophes in docs
slix Jul 2, 2015
27a158a
Fix handling output from tty-enabled containers.
dano Jun 7, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MAINTAINERS
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Joffrey F <f.joffrey@gmail.com> (@shin-)
Joffrey F <joffrey@docker.com> (@shin-)
Maxime Petazzoni <maxime.petazzoni@bulix.org> (@mpetazzoni)

Aanand Prasad <aanand@docker.com> (@aanand)
58 changes: 45 additions & 13 deletions docker/auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
from .. import errors

INDEX_URL = 'https://index.docker.io/v1/'
DOCKER_CONFIG_FILENAME = '.dockercfg'
DOCKER_CONFIG_FILENAME = os.path.join('.docker', 'config.json')
LEGACY_DOCKER_CONFIG_FILENAME = '.dockercfg'


def expand_registry_url(hostname, insecure=False):
Expand Down Expand Up @@ -107,6 +108,29 @@ def encode_full_header(auth):
return encode_header({'configs': auth})


def parse_auth(entries):
"""
Parses authentication entries

Args:
entries: Dict of authentication entries.

Returns:
Authentication registry.
"""

conf = {}
for registry, entry in six.iteritems(entries):
username, password = decode_auth(entry['auth'])
conf[registry] = {
'username': username,
'password': password,
'email': entry['email'],
'serveraddress': registry,
}
return conf


def load_config(config_path=None):
"""
Loads authentication data from a Docker configuration file in the given
Expand All @@ -115,26 +139,34 @@ def load_config(config_path=None):
conf = {}
data = None

config_file = config_path or os.path.join(os.environ.get('HOME', '.'),
# Prefer ~/.docker/config.json.
config_file = config_path or os.path.join(os.path.expanduser('~'),
DOCKER_CONFIG_FILENAME)

if os.path.exists(config_file):
try:
with open(config_file) as f:
for section, data in six.iteritems(json.load(f)):
if section != 'auths':
continue
return parse_auth(data)
except (IOError, KeyError, ValueError):
# Likely missing new Docker config file or it's in an
# unknown format, continue to attempt to read old location
# and format.
pass

config_file = config_path or os.path.join(os.path.expanduser('~'),
LEGACY_DOCKER_CONFIG_FILENAME)

# if config path doesn't exist return empty config
if not os.path.exists(config_file):
return {}

# First try as JSON
# Try reading legacy location as JSON.
try:
with open(config_file) as f:
conf = {}
for registry, entry in six.iteritems(json.load(f)):
username, password = decode_auth(entry['auth'])
conf[registry] = {
'username': username,
'password': password,
'email': entry['email'],
'serveraddress': registry,
}
return conf
return parse_auth(json.load(f))
except:
pass

Expand Down
Loading