fix: Initialize dockerClient to None
Changed dockerClient initialization to None to defer client creation until needed. This may prevent issues with early initialization in certain environments.
This commit is contained in:
parent
19a2c3509c
commit
8b5ed3cd19
|
|
@ -11,7 +11,7 @@ end_pattern = "#-----Do-not-add-hosts-after-this-line-----\n"
|
||||||
hosts_path = "/tmp/hosts"
|
hosts_path = "/tmp/hosts"
|
||||||
hosts = {}
|
hosts = {}
|
||||||
|
|
||||||
dockerClient = docker.DockerClient(base_url="unix:///var/run/docker.sock")
|
dockerClient = None
|
||||||
|
|
||||||
|
|
||||||
def signal_handler(sig, frame):
|
def signal_handler(sig, frame):
|
||||||
|
|
@ -72,6 +72,7 @@ def main():
|
||||||
|
|
||||||
|
|
||||||
def get_container(container_id):
|
def get_container(container_id):
|
||||||
|
global dockerClient
|
||||||
try:
|
try:
|
||||||
return dockerClient.containers.get(container_id)
|
return dockerClient.containers.get(container_id)
|
||||||
except docker.errors.NotFound:
|
except docker.errors.NotFound:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue