python docker api how do we set the path environment variable?How is Docker different from a virtual machine?Should I use Vagrant or Docker for creating an isolated environment?How to list containers in DockerHow to get a Docker container's IP address from the host?How to remove old Docker containersHow to deal with persistent storage (e.g. databases) in DockerHow do I pass environment variables to Docker containers?How to user docker exec with zshCannot pass env variables to dockerHow to run a command in Docker using custom arguments?

Are there balance issues when allowing attack of opportunity against any creature?

The 7-numbers crossword

Why did the VIC-II and SID use 6 µm technology in the era of 3 µm and 1.5 µm?

What are ways to record who took the pictures if a camera is used by multiple people?

Table alignment (make the content centre)

How can I portray a character with no fear of death, without them sounding utterly bored?

Function of the separated, individual solar cells on Telstar 1 and 2? Why were they "special"?

Fishing from underwater domes

New coworker has strange workplace requirements - how should I deal with them?

Blogging in LaTeX

Missing $ inserted. Extra }, or forgotten $. Missing } inserted

Is there anything in the universe that cannot be compressed?

Why do we need explainable AI?

Am I required to correct my opponent's assumptions about my morph creatures?

What is the motivation behind designing a control stick that does not move?

Can a system of three stars exist?

How did Gollum know Sauron was gathering the Haradrim to make war?

Given a specific computer system, is it possible to estimate the actual precise run time of a piece of Assembly code

How to use a tikzpicture as a node shape

When do we use "no women" instead of "no woman"?

German equivalent to "going down the rabbit hole"

Was there an original and definitive use of alternate dimensions/realities in fiction?

How to have the "Restore Missing Files" function from Nautilus without installing Nautilus?

Ways you can end up paying interest on a credit card if you pay the full amount back in due time



python docker api how do we set the path environment variable?


How is Docker different from a virtual machine?Should I use Vagrant or Docker for creating an isolated environment?How to list containers in DockerHow to get a Docker container's IP address from the host?How to remove old Docker containersHow to deal with persistent storage (e.g. databases) in DockerHow do I pass environment variables to Docker containers?How to user docker exec with zshCannot pass env variables to dockerHow to run a command in Docker using custom arguments?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am trying to set the PATH environment variable inside the container using python docker api but doesnt seems to work , the container is not starting



does anybody has idea how to set the PATH env variable, other env variables works file.



I am seeing the below error
OCI runtime exec failed: exec failed: container_linux.go:344: starting container process caused "exec: "bash": executable file not found in $PATH": unknown



(exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=["PATH=/usr/lib64/ccache"]) 

or


environment=[
"CCACHE_DIR=/work/.ccache",
"PATH=/usr/lib64/ccache",
"BUILDS_ALL_TIME=" + sys.argv[2],
"PATCH_10.2=" + sys.argv[1]],
working_dir="/OTINBuild",









share|improve this question





















  • 1





    That sounds like setting the environment variable is working fine, but the only container path being searched for any binaries at all is /usr/lib64/ccache and there's not a bash binary in that single directory. (If you want /bin to be searched it needs to be in $PATH too.)

    – David Maze
    Mar 28 at 3:12











  • As @DavidMaze mentioned it could be incorrect path / the path doesnt exist , check the docker logs (or) login into the newly created container and verify the path exist using basic commands ls -l yourpath and also verify whether other Environment variables are set or not.

    – Senthil
    Mar 31 at 23:41

















0















I am trying to set the PATH environment variable inside the container using python docker api but doesnt seems to work , the container is not starting



does anybody has idea how to set the PATH env variable, other env variables works file.



I am seeing the below error
OCI runtime exec failed: exec failed: container_linux.go:344: starting container process caused "exec: "bash": executable file not found in $PATH": unknown



(exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=["PATH=/usr/lib64/ccache"]) 

or


environment=[
"CCACHE_DIR=/work/.ccache",
"PATH=/usr/lib64/ccache",
"BUILDS_ALL_TIME=" + sys.argv[2],
"PATCH_10.2=" + sys.argv[1]],
working_dir="/OTINBuild",









share|improve this question





















  • 1





    That sounds like setting the environment variable is working fine, but the only container path being searched for any binaries at all is /usr/lib64/ccache and there's not a bash binary in that single directory. (If you want /bin to be searched it needs to be in $PATH too.)

    – David Maze
    Mar 28 at 3:12











  • As @DavidMaze mentioned it could be incorrect path / the path doesnt exist , check the docker logs (or) login into the newly created container and verify the path exist using basic commands ls -l yourpath and also verify whether other Environment variables are set or not.

    – Senthil
    Mar 31 at 23:41













0












0








0








I am trying to set the PATH environment variable inside the container using python docker api but doesnt seems to work , the container is not starting



does anybody has idea how to set the PATH env variable, other env variables works file.



I am seeing the below error
OCI runtime exec failed: exec failed: container_linux.go:344: starting container process caused "exec: "bash": executable file not found in $PATH": unknown



(exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=["PATH=/usr/lib64/ccache"]) 

or


environment=[
"CCACHE_DIR=/work/.ccache",
"PATH=/usr/lib64/ccache",
"BUILDS_ALL_TIME=" + sys.argv[2],
"PATCH_10.2=" + sys.argv[1]],
working_dir="/OTINBuild",









share|improve this question
















I am trying to set the PATH environment variable inside the container using python docker api but doesnt seems to work , the container is not starting



does anybody has idea how to set the PATH env variable, other env variables works file.



I am seeing the below error
OCI runtime exec failed: exec failed: container_linux.go:344: starting container process caused "exec: "bash": executable file not found in $PATH": unknown



(exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=["PATH=/usr/lib64/ccache"]) 

or


environment=[
"CCACHE_DIR=/work/.ccache",
"PATH=/usr/lib64/ccache",
"BUILDS_ALL_TIME=" + sys.argv[2],
"PATCH_10.2=" + sys.argv[1]],
working_dir="/OTINBuild",






docker dockerpy






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 2:51







user2511126

















asked Mar 28 at 1:06









user2511126user2511126

1431 gold badge5 silver badges19 bronze badges




1431 gold badge5 silver badges19 bronze badges










  • 1





    That sounds like setting the environment variable is working fine, but the only container path being searched for any binaries at all is /usr/lib64/ccache and there's not a bash binary in that single directory. (If you want /bin to be searched it needs to be in $PATH too.)

    – David Maze
    Mar 28 at 3:12











  • As @DavidMaze mentioned it could be incorrect path / the path doesnt exist , check the docker logs (or) login into the newly created container and verify the path exist using basic commands ls -l yourpath and also verify whether other Environment variables are set or not.

    – Senthil
    Mar 31 at 23:41












  • 1





    That sounds like setting the environment variable is working fine, but the only container path being searched for any binaries at all is /usr/lib64/ccache and there's not a bash binary in that single directory. (If you want /bin to be searched it needs to be in $PATH too.)

    – David Maze
    Mar 28 at 3:12











  • As @DavidMaze mentioned it could be incorrect path / the path doesnt exist , check the docker logs (or) login into the newly created container and verify the path exist using basic commands ls -l yourpath and also verify whether other Environment variables are set or not.

    – Senthil
    Mar 31 at 23:41







1




1





That sounds like setting the environment variable is working fine, but the only container path being searched for any binaries at all is /usr/lib64/ccache and there's not a bash binary in that single directory. (If you want /bin to be searched it needs to be in $PATH too.)

– David Maze
Mar 28 at 3:12





That sounds like setting the environment variable is working fine, but the only container path being searched for any binaries at all is /usr/lib64/ccache and there's not a bash binary in that single directory. (If you want /bin to be searched it needs to be in $PATH too.)

– David Maze
Mar 28 at 3:12













As @DavidMaze mentioned it could be incorrect path / the path doesnt exist , check the docker logs (or) login into the newly created container and verify the path exist using basic commands ls -l yourpath and also verify whether other Environment variables are set or not.

– Senthil
Mar 31 at 23:41





As @DavidMaze mentioned it could be incorrect path / the path doesnt exist , check the docker logs (or) login into the newly created container and verify the path exist using basic commands ls -l yourpath and also verify whether other Environment variables are set or not.

– Senthil
Mar 31 at 23:41












3 Answers
3






active

oldest

votes


















0















please share the api details (or) the python script full details - here its minimal includes your docker file (docker build cmd) .Refer below for the syntax and whether you are trying to override the environment variables set by the docker image build process ?



Ref: https://docker-py.readthedocs.io/en/stable/api.html



exec_create(container, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', environment=None, workdir=None, detach_keys=None)


environment (dict or list) – A dictionary or a list of strings in the following format ["PASSWORD=xxx"] or "PASSWORD": "xxx".





share|improve this answer

























  • (exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=["PATH=/usr/lib64/ccache"])

    – user2511126
    Mar 28 at 2:43


















0















Does the docker image has bash command. Try other generic command like sh, ls instead of bash.






share|improve this answer
































    0















    If you use the dictionary to set up your environment variable it will work like this:



    environment = "Name_Variable":"Name_Path","Name_Variable2":"Name_Path2"...
    (exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=environment)


    If you try to see if it work with the following command :



    docker exec -it "Name_Container" echo $Name_Variable


    It won't show you the value.



    The terminal is executing the $Name_Variable, before "sending" it to docker.



    You have to enter in your container using the bash and do echo $Name_Variable.






    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%2f55388716%2fpython-docker-api-how-do-we-set-the-path-environment-variable%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0















      please share the api details (or) the python script full details - here its minimal includes your docker file (docker build cmd) .Refer below for the syntax and whether you are trying to override the environment variables set by the docker image build process ?



      Ref: https://docker-py.readthedocs.io/en/stable/api.html



      exec_create(container, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', environment=None, workdir=None, detach_keys=None)


      environment (dict or list) – A dictionary or a list of strings in the following format ["PASSWORD=xxx"] or "PASSWORD": "xxx".





      share|improve this answer

























      • (exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=["PATH=/usr/lib64/ccache"])

        – user2511126
        Mar 28 at 2:43















      0















      please share the api details (or) the python script full details - here its minimal includes your docker file (docker build cmd) .Refer below for the syntax and whether you are trying to override the environment variables set by the docker image build process ?



      Ref: https://docker-py.readthedocs.io/en/stable/api.html



      exec_create(container, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', environment=None, workdir=None, detach_keys=None)


      environment (dict or list) – A dictionary or a list of strings in the following format ["PASSWORD=xxx"] or "PASSWORD": "xxx".





      share|improve this answer

























      • (exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=["PATH=/usr/lib64/ccache"])

        – user2511126
        Mar 28 at 2:43













      0














      0










      0









      please share the api details (or) the python script full details - here its minimal includes your docker file (docker build cmd) .Refer below for the syntax and whether you are trying to override the environment variables set by the docker image build process ?



      Ref: https://docker-py.readthedocs.io/en/stable/api.html



      exec_create(container, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', environment=None, workdir=None, detach_keys=None)


      environment (dict or list) – A dictionary or a list of strings in the following format ["PASSWORD=xxx"] or "PASSWORD": "xxx".





      share|improve this answer













      please share the api details (or) the python script full details - here its minimal includes your docker file (docker build cmd) .Refer below for the syntax and whether you are trying to override the environment variables set by the docker image build process ?



      Ref: https://docker-py.readthedocs.io/en/stable/api.html



      exec_create(container, cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', environment=None, workdir=None, detach_keys=None)


      environment (dict or list) – A dictionary or a list of strings in the following format ["PASSWORD=xxx"] or "PASSWORD": "xxx".






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Mar 28 at 2:03









      SenthilSenthil

      1,1231 gold badge7 silver badges17 bronze badges




      1,1231 gold badge7 silver badges17 bronze badges















      • (exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=["PATH=/usr/lib64/ccache"])

        – user2511126
        Mar 28 at 2:43

















      • (exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=["PATH=/usr/lib64/ccache"])

        – user2511126
        Mar 28 at 2:43
















      (exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=["PATH=/usr/lib64/ccache"])

      – user2511126
      Mar 28 at 2:43





      (exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=["PATH=/usr/lib64/ccache"])

      – user2511126
      Mar 28 at 2:43













      0















      Does the docker image has bash command. Try other generic command like sh, ls instead of bash.






      share|improve this answer





























        0















        Does the docker image has bash command. Try other generic command like sh, ls instead of bash.






        share|improve this answer



























          0














          0










          0









          Does the docker image has bash command. Try other generic command like sh, ls instead of bash.






          share|improve this answer













          Does the docker image has bash command. Try other generic command like sh, ls instead of bash.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 28 at 8:04









          Akash SharmaAkash Sharma

          4542 silver badges6 bronze badges




          4542 silver badges6 bronze badges
























              0















              If you use the dictionary to set up your environment variable it will work like this:



              environment = "Name_Variable":"Name_Path","Name_Variable2":"Name_Path2"...
              (exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=environment)


              If you try to see if it work with the following command :



              docker exec -it "Name_Container" echo $Name_Variable


              It won't show you the value.



              The terminal is executing the $Name_Variable, before "sending" it to docker.



              You have to enter in your container using the bash and do echo $Name_Variable.






              share|improve this answer





























                0















                If you use the dictionary to set up your environment variable it will work like this:



                environment = "Name_Variable":"Name_Path","Name_Variable2":"Name_Path2"...
                (exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=environment)


                If you try to see if it work with the following command :



                docker exec -it "Name_Container" echo $Name_Variable


                It won't show you the value.



                The terminal is executing the $Name_Variable, before "sending" it to docker.



                You have to enter in your container using the bash and do echo $Name_Variable.






                share|improve this answer



























                  0














                  0










                  0









                  If you use the dictionary to set up your environment variable it will work like this:



                  environment = "Name_Variable":"Name_Path","Name_Variable2":"Name_Path2"...
                  (exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=environment)


                  If you try to see if it work with the following command :



                  docker exec -it "Name_Container" echo $Name_Variable


                  It won't show you the value.



                  The terminal is executing the $Name_Variable, before "sending" it to docker.



                  You have to enter in your container using the bash and do echo $Name_Variable.






                  share|improve this answer













                  If you use the dictionary to set up your environment variable it will work like this:



                  environment = "Name_Variable":"Name_Path","Name_Variable2":"Name_Path2"...
                  (exitCode, socConn) = self.container.exec_run('bash -e build/otin/BashCheckGCCVersion.sh',socket=True,environment=environment)


                  If you try to see if it work with the following command :



                  docker exec -it "Name_Container" echo $Name_Variable


                  It won't show you the value.



                  The terminal is executing the $Name_Variable, before "sending" it to docker.



                  You have to enter in your container using the bash and do echo $Name_Variable.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 10 at 10:02









                  newbStudentnewbStudent

                  84 bronze badges




                  84 bronze badges






























                      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%2f55388716%2fpython-docker-api-how-do-we-set-the-path-environment-variable%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

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                      Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript