DockStation / dockstation

DockStation is developer-centric application to managing projects based on Docker. Instead of lots of CLI commands you can monitor, configure, and manage services and containers using just a GUI.
https://dockstation.io/
2.14k stars 106 forks source link

How to choose docker-compose binary ? #146

Open boskiv opened 5 years ago

boskiv commented 5 years ago

Is there way to choose executable file for docker-compose on Windows Or path (venv) to use it on OSX ? Because I have on OSX an error

Failed to fetch container logs: 
Command failed: /usr/local/bin/docker-compose -f docker-compose.yml -p test logs --tail=1000 mongo 2>&1

[stdout]: Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 11, in 
    load_entry_point('docker-compose==1.22.0', 'console_scripts', 'docker-compose')()
  File "/usr/local/Cellar/docker-compose/1.22.0_2/libexec/lib/python3.7/site-packages/compose/cli/main.py", line 71, in main
    command()
  File "/usr/local/Cellar/docker-compose/1.22.0_2/libexec/lib/python3.7/site-packages/compose/cli/main.py", line 124, in perform_command
    project = project_from_options('.', options)
  File "/usr/local/Cellar/docker-compose/1.22.0_2/libexec/lib/python3.7/site-packages/compose/cli/command.py", line 41, in project_from_options
    compatibility=options.get('--compatibility'),
  File "/usr/local/Cellar/docker-compose/1.22.0_2/libexec/lib/python3.7/site-packages/compose/cli/command.py", line 126, in get_project
    project_name, config_data, client, environment.get('DOCKER_DEFAULT_PLATFORM')
  File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/Cellar/docker-compose/1.22.0_2/libexec/lib/python3.7/site-packages/compose/cli/errors.py", line 53, in handle_connection_errors
    exit_with_error(get_conn_error_message(client.base_url))
  File "/usr/local/Cellar/docker-compose/1.22.0_2/libexec/lib/python3.7/site-packages/compose/cli/errors.py", line 120, in get_conn_error_message
    if find_executable('docker') is None:
  File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/spawn.py", line 176, in find_executable
    path = os.environ['PATH']
  File "/usr/local/Cellar/docker-compose/1.22.0_2/libexec/bin/../lib/python3.7/os.py", line 678, in __getitem__
    raise KeyError(key) from None
KeyError: 'PATH'

On WIndows it drop an error

file not found
igor-lemon commented 5 years ago

Hi @boskiv No, we don't have this option. The app checks all $PATH paths and looking for docker-compose file.

The solutions 1) Check all export directories.

echo $PATH

Set your custom directory first than /usr/local/bin. Finally result should be some as

...:/YOUR_CUSTOM_DIR:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/...

2) Set symlink from your custom docker-compose to default bin directory

ln -sf /CUSTOM_DIR/docker-compose /usr/local/bin/docker-compose

Unfortunately, I can't say anything about Windows but I think you can reproduce it similarly.

igor-lemon commented 5 years ago

But in your log the problem isn't relating with the path of Docker Compose.

boskiv commented 5 years ago

Yeah, thanks. I will try to check my envs.

boskiv commented 5 years ago

This how it's look on windows. docker-compose works fine from powershell or cmd. envs are set right. docker, docker-compose, docker-machine was installed with choco

choco install docker docker-compose docker-machine

screenshot 2018-10-24 at 9 17 22 am

boskiv commented 5 years ago

How can I check Environment that App use ? I have installed App for User only, not for all. Hope it helps.

boskiv commented 5 years ago

Ok, I have run process explorer and there is an env: screenshot 2018-10-24 at 9 31 58 am

Looks like docker-compose under path

igor-lemon commented 5 years ago

I'll try to check your case. I can't do it now because I don't have a Windows PC. I will definitely let you know results.

boskiv commented 5 years ago

I'm using Virtual Machine with Windows in cases like this.

igor-lemon commented 5 years ago

So, Do I understand you that 1) You've Virtual Machine with Windows 10? 2) You're using Docker Machine in the VM?

boskiv commented 5 years ago

Yes. I have Paralles VM with Windows 10. I have Orace virtualbox inside Windows 10. I'm testing solution for our developers more convenient to work with docker. So I have this environment. But It should not be a problem because of isolation. Nested virtualisation enabled of cause. And docker also work from command line.

igor-lemon commented 5 years ago

Do you use Docker for Windows or Docker toolbox ?

boskiv commented 5 years ago

I think nothing of it. I have install docker from choco package manager. There is just docker client, docker-machine and docker-compose binaries

igor-lemon commented 5 years ago

So we reproduced your problem and found the same issues. You didn't start Docker daemon. https://github.com/docker/toolbox/issues/725

But unfortunately, I can't say anything about your case with choco package manager. We'll try to check it a bit later. At the moment I can recommend to install and use the latest version Docker For Windows.

igor-lemon commented 5 years ago

Huh. We found and fixed one bug which reproduced with Docker Toolbox only for Windows. This is bug very similar with your case, but I can't promise it will able to resolve your issue.

boskiv commented 5 years ago

Thanks, Igor. I will try, but I have docker daemon inside my Oracle docker-machine created VM, why I need to have one on Windows. And I have docker-compose up working in PowerSHell without local daemon started

PS C:\Users\i_skiridomov> docker-machine start
Starting "default"...
(default) Check network to re-create if needed...
(default) Windows might ask for the permission to configure a dhcp server. Sometimes, such confirmation window is minimized in the taskbar.
(default) Waiting for an IP...
Machine "default" was started.
Waiting for SSH to be available...
Detecting the provisioner...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
PS C:\Users\i_skiridomov> docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

PS C:\Users\i_skiridomov> cd .\Documents\
PS C:\Users\i_skiridomov\Documents> cd .\Demo\

PS C:\Users\i_skiridomov\Documents\Demo> docker-compose up
Creating network "demo_default" with the default driver
Pulling mysql (mysql:)...
latest: Pulling from library/mysql
f17d81b4b692: Pull complete
c691115e6ae9: Pull complete
41544cb19235: Pull complete
254d04f5f66d: Pull complete
4fe240edfdc9: Pull complete
0cd4fcc94b67: Extracting [========================>                          ]  6.029MB/12.09MB
8df36ec4b34a: Download complete
720bf9851f6a: Download complete

9ffdbf5f677f: Download complete
a403e1df0389: Waiting
4669c5f285a6: Waiting
boskiv commented 5 years ago

Building images also works fine

PS C:\Users\i_skiridomov\Documents\Demo> docker-compose up
Building custom
Step 1/1 : FROM nginx
latest: Pulling from library/nginx
f17d81b4b692: Already exists
d5c237920c39: Pull complete
a381f92f36de: Pull complete
Digest: sha256:b73f527d86e3461fd652f62cf47e7b375196063bbbd503e853af5be16597cb2e
Status: Downloaded newer image for nginx:latest
 ---> dbfc48660aeb

Successfully built dbfc48660aeb
Successfully tagged demo_custom:latest
WARNING: Image for service custom was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Starting demo_mysql_1  ... done
Creating demo_custom_1 ... done
Attaching to demo_mysql_1, demo_custom_1
mysql_1   | error: database is uninitialized and password option is not specified
mysql_1   |   You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
demo_mysql_1 exited with code 1
boskiv commented 5 years ago

All I need to works with is env:

PS C:\Users\i_skiridomov\Documents\Demo> Get-ChildItem env:

Name                           Value
----                           -----
DOCKER_CERT_PATH               C:\Users\i_skiridomov\.docker\machine\machines\default
DOCKER_HOST                    tcp://192.168.99.100:2376
DOCKER_MACHINE_NAME            default
DOCKER_TLS_VERIFY              1
PS C:\Users\i_skiridomov\Documents\Demo>
igor-lemon commented 5 years ago

So, I think this is the bug which we fixed yesterday. I'll try to build a temporary build. Will you able to check it?

boskiv commented 5 years ago

Sure I will, thanks.

igor-lemon commented 5 years ago

Please write me to igor@dockstation.io I'll send you a pre-release version for test.

guzart commented 5 years ago

Hello @igor-lemon,

Could this issue be the same as the one reported by jacoblyw? I am having the same issue KeyError: 'PATH' on OS 10.14.

igor-lemon commented 5 years ago

Hi @guzart. I'll try to find a solution today.