Calling docker-compose with python subprocess ends with FileNotFoundError 'docker-compose'












0















I am quite new to docker so I ran into some error state with my python script. It should listen for a couple of docker containers which have been started with docker-compose up using a specific yaml file.



The ignition process is working but when one container goes down another one (observing entity) should revive it with, say docker-compose start deadmodule



My setup:




  • OS: Windows 10

  • Docker: 2.0.0.0-win78 (28905)

  • Docker Engine: 18.09.0

  • Compose: 1.23.1

  • Python 3.6


I am trying this:



subprocess.call('docker-compose',
'start',
'deadmodule')


And I tried it also with Popen(['docker-compose', 'start', 'deadmodule'], stdout=PIPE, stderr=PIPE)



However it ends with this:



FileNotFoundError: [Errno 2] No such file or directory: 'docker-compose': 'docker-compose'









share|improve this question























  • Is it on the PATH? Have you tried docker-compose.exe instead?

    – kutschkem
    Nov 23 '18 at 10:38











  • It is on the PATH, since I can call it manually on the windows console without any problems.

    – Andre
    Nov 23 '18 at 10:41











  • why don't just use restart=always in the compose file to revive it automatically with docker?

    – Siyu
    Nov 23 '18 at 11:01











  • I do when I encounter any python errors they (containers) do not always come up again.

    – Andre
    Nov 23 '18 at 11:21
















0















I am quite new to docker so I ran into some error state with my python script. It should listen for a couple of docker containers which have been started with docker-compose up using a specific yaml file.



The ignition process is working but when one container goes down another one (observing entity) should revive it with, say docker-compose start deadmodule



My setup:




  • OS: Windows 10

  • Docker: 2.0.0.0-win78 (28905)

  • Docker Engine: 18.09.0

  • Compose: 1.23.1

  • Python 3.6


I am trying this:



subprocess.call('docker-compose',
'start',
'deadmodule')


And I tried it also with Popen(['docker-compose', 'start', 'deadmodule'], stdout=PIPE, stderr=PIPE)



However it ends with this:



FileNotFoundError: [Errno 2] No such file or directory: 'docker-compose': 'docker-compose'









share|improve this question























  • Is it on the PATH? Have you tried docker-compose.exe instead?

    – kutschkem
    Nov 23 '18 at 10:38











  • It is on the PATH, since I can call it manually on the windows console without any problems.

    – Andre
    Nov 23 '18 at 10:41











  • why don't just use restart=always in the compose file to revive it automatically with docker?

    – Siyu
    Nov 23 '18 at 11:01











  • I do when I encounter any python errors they (containers) do not always come up again.

    – Andre
    Nov 23 '18 at 11:21














0












0








0








I am quite new to docker so I ran into some error state with my python script. It should listen for a couple of docker containers which have been started with docker-compose up using a specific yaml file.



The ignition process is working but when one container goes down another one (observing entity) should revive it with, say docker-compose start deadmodule



My setup:




  • OS: Windows 10

  • Docker: 2.0.0.0-win78 (28905)

  • Docker Engine: 18.09.0

  • Compose: 1.23.1

  • Python 3.6


I am trying this:



subprocess.call('docker-compose',
'start',
'deadmodule')


And I tried it also with Popen(['docker-compose', 'start', 'deadmodule'], stdout=PIPE, stderr=PIPE)



However it ends with this:



FileNotFoundError: [Errno 2] No such file or directory: 'docker-compose': 'docker-compose'









share|improve this question














I am quite new to docker so I ran into some error state with my python script. It should listen for a couple of docker containers which have been started with docker-compose up using a specific yaml file.



The ignition process is working but when one container goes down another one (observing entity) should revive it with, say docker-compose start deadmodule



My setup:




  • OS: Windows 10

  • Docker: 2.0.0.0-win78 (28905)

  • Docker Engine: 18.09.0

  • Compose: 1.23.1

  • Python 3.6


I am trying this:



subprocess.call('docker-compose',
'start',
'deadmodule')


And I tried it also with Popen(['docker-compose', 'start', 'deadmodule'], stdout=PIPE, stderr=PIPE)



However it ends with this:



FileNotFoundError: [Errno 2] No such file or directory: 'docker-compose': 'docker-compose'






python docker docker-compose subprocess






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 '18 at 10:25









AndreAndre

3,29542029




3,29542029













  • Is it on the PATH? Have you tried docker-compose.exe instead?

    – kutschkem
    Nov 23 '18 at 10:38











  • It is on the PATH, since I can call it manually on the windows console without any problems.

    – Andre
    Nov 23 '18 at 10:41











  • why don't just use restart=always in the compose file to revive it automatically with docker?

    – Siyu
    Nov 23 '18 at 11:01











  • I do when I encounter any python errors they (containers) do not always come up again.

    – Andre
    Nov 23 '18 at 11:21



















  • Is it on the PATH? Have you tried docker-compose.exe instead?

    – kutschkem
    Nov 23 '18 at 10:38











  • It is on the PATH, since I can call it manually on the windows console without any problems.

    – Andre
    Nov 23 '18 at 10:41











  • why don't just use restart=always in the compose file to revive it automatically with docker?

    – Siyu
    Nov 23 '18 at 11:01











  • I do when I encounter any python errors they (containers) do not always come up again.

    – Andre
    Nov 23 '18 at 11:21

















Is it on the PATH? Have you tried docker-compose.exe instead?

– kutschkem
Nov 23 '18 at 10:38





Is it on the PATH? Have you tried docker-compose.exe instead?

– kutschkem
Nov 23 '18 at 10:38













It is on the PATH, since I can call it manually on the windows console without any problems.

– Andre
Nov 23 '18 at 10:41





It is on the PATH, since I can call it manually on the windows console without any problems.

– Andre
Nov 23 '18 at 10:41













why don't just use restart=always in the compose file to revive it automatically with docker?

– Siyu
Nov 23 '18 at 11:01





why don't just use restart=always in the compose file to revive it automatically with docker?

– Siyu
Nov 23 '18 at 11:01













I do when I encounter any python errors they (containers) do not always come up again.

– Andre
Nov 23 '18 at 11:21





I do when I encounter any python errors they (containers) do not always come up again.

– Andre
Nov 23 '18 at 11:21












1 Answer
1






active

oldest

votes


















1














When you are not using shell=True, the file ending won't be automatically added, so what you need to call is docker-compose.exe, not docker-compose.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53444881%2fcalling-docker-compose-with-python-subprocess-ends-with-filenotfounderror-docke%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    When you are not using shell=True, the file ending won't be automatically added, so what you need to call is docker-compose.exe, not docker-compose.






    share|improve this answer




























      1














      When you are not using shell=True, the file ending won't be automatically added, so what you need to call is docker-compose.exe, not docker-compose.






      share|improve this answer


























        1












        1








        1







        When you are not using shell=True, the file ending won't be automatically added, so what you need to call is docker-compose.exe, not docker-compose.






        share|improve this answer













        When you are not using shell=True, the file ending won't be automatically added, so what you need to call is docker-compose.exe, not docker-compose.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 23 '18 at 11:08









        kutschkemkutschkem

        3,71911136




        3,71911136
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53444881%2fcalling-docker-compose-with-python-subprocess-ends-with-filenotfounderror-docke%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            Origin of the phrase “under your belt”?