mirror of
https://github.com/docker/compose.git
synced 2025-07-22 21:24:38 +02:00
Show installation instructions if it looks like Docker isn't installed
This commit is contained in:
parent
5126649de4
commit
2bac1c10b0
@ -11,7 +11,7 @@ import yaml
|
|||||||
from ..project import Project
|
from ..project import Project
|
||||||
from .docopt_command import DocoptCommand
|
from .docopt_command import DocoptCommand
|
||||||
from .formatter import Formatter
|
from .formatter import Formatter
|
||||||
from .utils import cached_property, docker_url, call_silently
|
from .utils import cached_property, docker_url, call_silently, is_mac, is_ubuntu
|
||||||
from .errors import UserError
|
from .errors import UserError
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -23,7 +23,26 @@ class Command(DocoptCommand):
|
|||||||
try:
|
try:
|
||||||
super(Command, self).dispatch(*args, **kwargs)
|
super(Command, self).dispatch(*args, **kwargs)
|
||||||
except ConnectionError:
|
except ConnectionError:
|
||||||
if call_silently(['which', 'docker-osx']) == 0:
|
if call_silently(['which', 'docker']) != 0:
|
||||||
|
if is_mac():
|
||||||
|
raise UserError("""
|
||||||
|
Couldn't connect to Docker daemon. You might need to install docker-osx:
|
||||||
|
|
||||||
|
https://github.com/noplay/docker-osx
|
||||||
|
""")
|
||||||
|
elif is_ubuntu():
|
||||||
|
raise UserError("""
|
||||||
|
Couldn't connect to Docker daemon. You might need to install Docker:
|
||||||
|
|
||||||
|
http://docs.docker.io/en/latest/installation/ubuntulinux/
|
||||||
|
""")
|
||||||
|
else:
|
||||||
|
raise UserError("""
|
||||||
|
Couldn't connect to Docker daemon. You might need to install Docker:
|
||||||
|
|
||||||
|
http://docs.docker.io/en/latest/installation/
|
||||||
|
""")
|
||||||
|
elif call_silently(['which', 'docker-osx']) == 0:
|
||||||
raise UserError("Couldn't connect to Docker daemon - you might need to run `docker-osx shell`.")
|
raise UserError("Couldn't connect to Docker daemon - you might need to run `docker-osx shell`.")
|
||||||
else:
|
else:
|
||||||
raise UserError("""
|
raise UserError("""
|
||||||
|
@ -5,6 +5,7 @@ import datetime
|
|||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import platform
|
||||||
from .errors import UserError
|
from .errors import UserError
|
||||||
|
|
||||||
|
|
||||||
@ -117,3 +118,11 @@ def call_silently(*args, **kwargs):
|
|||||||
"""
|
"""
|
||||||
with open(os.devnull, 'w') as shutup:
|
with open(os.devnull, 'w') as shutup:
|
||||||
return subprocess.call(*args, stdout=shutup, stderr=shutup, **kwargs)
|
return subprocess.call(*args, stdout=shutup, stderr=shutup, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def is_mac():
|
||||||
|
return platform.system() == 'Darwin'
|
||||||
|
|
||||||
|
|
||||||
|
def is_ubuntu():
|
||||||
|
return platform.system() == 'Linux'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user