mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-25 09:24:23 +01:00
Merge pull request #54 from jina-ai/fix-is-docker-running
fix: is docker running
This commit is contained in:
@@ -185,7 +185,7 @@ def run_locally(executor_name, microservice_version_path):
|
||||
use_docker = True
|
||||
else:
|
||||
click.echo('''
|
||||
Docker daemon doesn\'t seem to be running.
|
||||
Docker daemon doesn\'t seem to be running (possible reasons: incorrect docker installation, docker command isn\'t in system path, insufficient permissions, docker is running but unrespnsive).
|
||||
It might be important to run your microservice within a docker container.
|
||||
Your machine might not have all the dependencies installed.
|
||||
You have 3 options:
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
import os
|
||||
|
||||
import concurrent.futures
|
||||
from typing import Generator
|
||||
import subprocess
|
||||
import sys
|
||||
from contextlib import contextmanager
|
||||
|
||||
import docker
|
||||
from docker import APIClient
|
||||
|
||||
|
||||
def get_microservice_path(path, microservice_name, packages, num_approach, version):
|
||||
package_path = '_'.join(packages)
|
||||
@@ -44,14 +40,12 @@ def suppress_stdout():
|
||||
|
||||
def is_docker_running():
|
||||
try:
|
||||
from hubble import __windows__
|
||||
_client = docker.from_env()
|
||||
# low-level client
|
||||
_raw_client = APIClient(
|
||||
base_url=docker.constants.DEFAULT_NPIPE
|
||||
if __windows__
|
||||
else docker.constants.DEFAULT_UNIX_SOCKET
|
||||
)
|
||||
except Exception:
|
||||
if sys.platform.startswith('win'):
|
||||
command = 'docker info'
|
||||
else:
|
||||
command = 'docker info 2> /dev/null'
|
||||
|
||||
subprocess.check_output(command, shell=True)
|
||||
return True
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
return True
|
||||
Reference in New Issue
Block a user