mirror of
https://github.com/thegeeklab/docker-tidy.git
synced 2024-11-22 12:10:40 +00:00
Instantiate APIClient using defined envars e.g. DOCKER_HOST
This commit is contained in:
parent
8eb165385f
commit
fc72a150d8
@ -13,6 +13,7 @@ import docker.errors
|
|||||||
import requests.exceptions
|
import requests.exceptions
|
||||||
|
|
||||||
from docker_custodian.args import timedelta_type
|
from docker_custodian.args import timedelta_type
|
||||||
|
from docker.utils import kwargs_from_env
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -66,7 +67,9 @@ def main():
|
|||||||
stream=sys.stdout)
|
stream=sys.stdout)
|
||||||
|
|
||||||
opts = get_opts()
|
opts = get_opts()
|
||||||
client = docker.APIClient(version='auto', timeout=opts.timeout)
|
client = docker.APIClient(version='auto',
|
||||||
|
timeout=opts.timeout,
|
||||||
|
**kwargs_from_env())
|
||||||
|
|
||||||
matcher = build_container_matcher(opts.prefix)
|
matcher = build_container_matcher(opts.prefix)
|
||||||
stop_containers(client, opts.max_run_time, matcher, opts.dry_run)
|
stop_containers(client, opts.max_run_time, matcher, opts.dry_run)
|
||||||
|
@ -14,6 +14,7 @@ import docker.errors
|
|||||||
import requests.exceptions
|
import requests.exceptions
|
||||||
|
|
||||||
from docker_custodian.args import timedelta_type
|
from docker_custodian.args import timedelta_type
|
||||||
|
from docker.utils import kwargs_from_env
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -220,7 +221,9 @@ def main():
|
|||||||
stream=sys.stdout)
|
stream=sys.stdout)
|
||||||
|
|
||||||
args = get_args()
|
args = get_args()
|
||||||
client = docker.APIClient(version='auto', timeout=args.timeout)
|
client = docker.APIClient(version='auto',
|
||||||
|
timeout=args.timeout,
|
||||||
|
**kwargs_from_env())
|
||||||
|
|
||||||
if args.max_container_age:
|
if args.max_container_age:
|
||||||
cleanup_containers(client, args.max_container_age, args.dry_run)
|
cleanup_containers(client, args.max_container_age, args.dry_run)
|
||||||
|
Loading…
Reference in New Issue
Block a user