Skip to content
Open
Changes from all commits
Commits
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
8 changes: 7 additions & 1 deletion docker/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import requests.adapters
import requests.exceptions

from .. import auth
from .. import auth, context
from ..constants import (
DEFAULT_MAX_POOL_SIZE,
DEFAULT_NUM_POOLS,
Expand Down Expand Up @@ -124,6 +124,12 @@ def __init__(self, base_url=None, version=None,
'If using TLS, the base_url argument must be provided.'
)

if base_url is None:
current_ctx = context.ContextAPI.get_current_context()
if current_ctx is not None:
base_url = current_ctx.Host
tls = current_ctx.TLSConfig

self.base_url = base_url
self.timeout = timeout
self.headers['User-Agent'] = user_agent
Expand Down