Reputation: 21
I was trying to run docker-compose using Fabric, but when I run the docker-compose up command using Fabric I got the following error:
[52577] Failed to execute script docker-compose
Traceback (most recent call last):
File "docker-compose", line 6, in <module>
File "compose/cli/main.py", line 71, in main
File "compose/cli/main.py", line 127, in perform_command
File "compose/cli/main.py", line 1080, in up
File "compose/cli/main.py", line 1076, in up
File "compose/project.py", line 475, in up
File "compose/service.py", line 352, in ensure_image_exists
File "compose/service.py", line 1217, in pull
File "compose/progress_stream.py", line 101, in get_digest_from_pull
File "compose/service.py", line 1182, in _do_pull
File "site-packages/docker/api/image.py", line 381, in pull
File "site-packages/docker/auth.py", line 48, in get_config_header
File "site-packages/docker/auth.py", line 96, in resolve_authconfig
File "site-packages/docker/auth.py", line 127, in _resolve_authconfig_credstore
File "site-packages/dockerpycreds/store.py", line 20, in __init__
File "site-packages/dockerpycreds/utils.py", line 12, in find_executable
File "distutils/spawn.py", line 176, in find_executable
File "os.py", line 669, in __getitem__
KeyError: 'PATH'
Failed to up the env
When I run docker-compose up from the terminal it works fine.
@task
def up(c):
if c.run('docker-compose up', warn=True).failed:
print ("Failed to up the env")
Upvotes: 2
Views: 749
Reputation: 228
As my comment suggested, it seems docker-composer up
when it needs to do a build
at least, needs the PATH
environment variable to be set. To fix, I just forwarded the PATH
from the current session to the child process (in PHP sorry!):
$compose = new Process( 'docker-compose up -d', '', [
'VOLUME' => getcwd(),
'PATH' => getenv( 'PATH' ),
] );
Upvotes: 2