How can I re-access a bash console in a Docker?










0















Im starting some python scripts on a DGX Server running a Nvidia Tensorflow docker. I've managed once to re enter the docker file, where I could see that the process was still running. However I couldn't see the new prints in the console anymore.



Is there a way I can run the docker e.g. a whole night and when I re enter it I can see my complete printed logs in the bash console?










share|improve this question


























    0















    Im starting some python scripts on a DGX Server running a Nvidia Tensorflow docker. I've managed once to re enter the docker file, where I could see that the process was still running. However I couldn't see the new prints in the console anymore.



    Is there a way I can run the docker e.g. a whole night and when I re enter it I can see my complete printed logs in the bash console?










    share|improve this question
























      0












      0








      0








      Im starting some python scripts on a DGX Server running a Nvidia Tensorflow docker. I've managed once to re enter the docker file, where I could see that the process was still running. However I couldn't see the new prints in the console anymore.



      Is there a way I can run the docker e.g. a whole night and when I re enter it I can see my complete printed logs in the bash console?










      share|improve this question














      Im starting some python scripts on a DGX Server running a Nvidia Tensorflow docker. I've managed once to re enter the docker file, where I could see that the process was still running. However I couldn't see the new prints in the console anymore.



      Is there a way I can run the docker e.g. a whole night and when I re enter it I can see my complete printed logs in the bash console?







      docker console






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 17:22









      Mr.Sh4nnonMr.Sh4nnon

      6111




      6111






















          2 Answers
          2






          active

          oldest

          votes


















          2














          I think you are wanting logging. I have only done application logging but maybe this will help: https://docs.docker.com/engine/reference/commandline/logs/



          $ docker logs [OPTIONS] CONTAINER


          edit: Additional links:



          log.rowanto.com/docker-console-logs-problem



          docs.docker.com/config/containers/logging






          share|improve this answer

























          • Cool that helps! However, I'd be nice if the console stays open anyway. Is there no way to achieve this?

            – Mr.Sh4nnon
            Nov 13 '18 at 18:23






          • 1





            Do you want the console from where you started the docker container to stay open and display the logs? eg. docker run image

            – Clayton Harbich
            Nov 13 '18 at 18:28











          • Well yes, it is the same console. I have to connect to the server by ssh. Then I start my docker, and run my python script. When the SSH closes I can get back in the docker, but I can't "re-enter" my console.

            – Mr.Sh4nnon
            Nov 13 '18 at 18:31






          • 1





            I don't know how to handle this through SSH. Some helpful links might be: log.rowanto.com/docker-console-logs-problem docs.docker.com/config/containers/logging

            – Clayton Harbich
            Nov 13 '18 at 18:37






          • 1





            Thank you very much! I guess I'll do it that way :)

            – Mr.Sh4nnon
            Nov 13 '18 at 18:38


















          0














          $ docker attach [CONTAINER ID]


          did the job to re-enter my console over ssh. However as Clayton Harbich pointed out



          $ docker logs [OPTIONS] CONTAINER ID


          is what I needed without knowing. Re-entering the console with attach doesn't show the history of console entries. So with those two commands I was able to see what happened and can further observe the scripts process.






          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%2f53286438%2fhow-can-i-re-access-a-bash-console-in-a-docker%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            I think you are wanting logging. I have only done application logging but maybe this will help: https://docs.docker.com/engine/reference/commandline/logs/



            $ docker logs [OPTIONS] CONTAINER


            edit: Additional links:



            log.rowanto.com/docker-console-logs-problem



            docs.docker.com/config/containers/logging






            share|improve this answer

























            • Cool that helps! However, I'd be nice if the console stays open anyway. Is there no way to achieve this?

              – Mr.Sh4nnon
              Nov 13 '18 at 18:23






            • 1





              Do you want the console from where you started the docker container to stay open and display the logs? eg. docker run image

              – Clayton Harbich
              Nov 13 '18 at 18:28











            • Well yes, it is the same console. I have to connect to the server by ssh. Then I start my docker, and run my python script. When the SSH closes I can get back in the docker, but I can't "re-enter" my console.

              – Mr.Sh4nnon
              Nov 13 '18 at 18:31






            • 1





              I don't know how to handle this through SSH. Some helpful links might be: log.rowanto.com/docker-console-logs-problem docs.docker.com/config/containers/logging

              – Clayton Harbich
              Nov 13 '18 at 18:37






            • 1





              Thank you very much! I guess I'll do it that way :)

              – Mr.Sh4nnon
              Nov 13 '18 at 18:38















            2














            I think you are wanting logging. I have only done application logging but maybe this will help: https://docs.docker.com/engine/reference/commandline/logs/



            $ docker logs [OPTIONS] CONTAINER


            edit: Additional links:



            log.rowanto.com/docker-console-logs-problem



            docs.docker.com/config/containers/logging






            share|improve this answer

























            • Cool that helps! However, I'd be nice if the console stays open anyway. Is there no way to achieve this?

              – Mr.Sh4nnon
              Nov 13 '18 at 18:23






            • 1





              Do you want the console from where you started the docker container to stay open and display the logs? eg. docker run image

              – Clayton Harbich
              Nov 13 '18 at 18:28











            • Well yes, it is the same console. I have to connect to the server by ssh. Then I start my docker, and run my python script. When the SSH closes I can get back in the docker, but I can't "re-enter" my console.

              – Mr.Sh4nnon
              Nov 13 '18 at 18:31






            • 1





              I don't know how to handle this through SSH. Some helpful links might be: log.rowanto.com/docker-console-logs-problem docs.docker.com/config/containers/logging

              – Clayton Harbich
              Nov 13 '18 at 18:37






            • 1





              Thank you very much! I guess I'll do it that way :)

              – Mr.Sh4nnon
              Nov 13 '18 at 18:38













            2












            2








            2







            I think you are wanting logging. I have only done application logging but maybe this will help: https://docs.docker.com/engine/reference/commandline/logs/



            $ docker logs [OPTIONS] CONTAINER


            edit: Additional links:



            log.rowanto.com/docker-console-logs-problem



            docs.docker.com/config/containers/logging






            share|improve this answer















            I think you are wanting logging. I have only done application logging but maybe this will help: https://docs.docker.com/engine/reference/commandline/logs/



            $ docker logs [OPTIONS] CONTAINER


            edit: Additional links:



            log.rowanto.com/docker-console-logs-problem



            docs.docker.com/config/containers/logging







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 13 '18 at 18:53

























            answered Nov 13 '18 at 17:35









            Clayton HarbichClayton Harbich

            272313




            272313












            • Cool that helps! However, I'd be nice if the console stays open anyway. Is there no way to achieve this?

              – Mr.Sh4nnon
              Nov 13 '18 at 18:23






            • 1





              Do you want the console from where you started the docker container to stay open and display the logs? eg. docker run image

              – Clayton Harbich
              Nov 13 '18 at 18:28











            • Well yes, it is the same console. I have to connect to the server by ssh. Then I start my docker, and run my python script. When the SSH closes I can get back in the docker, but I can't "re-enter" my console.

              – Mr.Sh4nnon
              Nov 13 '18 at 18:31






            • 1





              I don't know how to handle this through SSH. Some helpful links might be: log.rowanto.com/docker-console-logs-problem docs.docker.com/config/containers/logging

              – Clayton Harbich
              Nov 13 '18 at 18:37






            • 1





              Thank you very much! I guess I'll do it that way :)

              – Mr.Sh4nnon
              Nov 13 '18 at 18:38

















            • Cool that helps! However, I'd be nice if the console stays open anyway. Is there no way to achieve this?

              – Mr.Sh4nnon
              Nov 13 '18 at 18:23






            • 1





              Do you want the console from where you started the docker container to stay open and display the logs? eg. docker run image

              – Clayton Harbich
              Nov 13 '18 at 18:28











            • Well yes, it is the same console. I have to connect to the server by ssh. Then I start my docker, and run my python script. When the SSH closes I can get back in the docker, but I can't "re-enter" my console.

              – Mr.Sh4nnon
              Nov 13 '18 at 18:31






            • 1





              I don't know how to handle this through SSH. Some helpful links might be: log.rowanto.com/docker-console-logs-problem docs.docker.com/config/containers/logging

              – Clayton Harbich
              Nov 13 '18 at 18:37






            • 1





              Thank you very much! I guess I'll do it that way :)

              – Mr.Sh4nnon
              Nov 13 '18 at 18:38
















            Cool that helps! However, I'd be nice if the console stays open anyway. Is there no way to achieve this?

            – Mr.Sh4nnon
            Nov 13 '18 at 18:23





            Cool that helps! However, I'd be nice if the console stays open anyway. Is there no way to achieve this?

            – Mr.Sh4nnon
            Nov 13 '18 at 18:23




            1




            1





            Do you want the console from where you started the docker container to stay open and display the logs? eg. docker run image

            – Clayton Harbich
            Nov 13 '18 at 18:28





            Do you want the console from where you started the docker container to stay open and display the logs? eg. docker run image

            – Clayton Harbich
            Nov 13 '18 at 18:28













            Well yes, it is the same console. I have to connect to the server by ssh. Then I start my docker, and run my python script. When the SSH closes I can get back in the docker, but I can't "re-enter" my console.

            – Mr.Sh4nnon
            Nov 13 '18 at 18:31





            Well yes, it is the same console. I have to connect to the server by ssh. Then I start my docker, and run my python script. When the SSH closes I can get back in the docker, but I can't "re-enter" my console.

            – Mr.Sh4nnon
            Nov 13 '18 at 18:31




            1




            1





            I don't know how to handle this through SSH. Some helpful links might be: log.rowanto.com/docker-console-logs-problem docs.docker.com/config/containers/logging

            – Clayton Harbich
            Nov 13 '18 at 18:37





            I don't know how to handle this through SSH. Some helpful links might be: log.rowanto.com/docker-console-logs-problem docs.docker.com/config/containers/logging

            – Clayton Harbich
            Nov 13 '18 at 18:37




            1




            1





            Thank you very much! I guess I'll do it that way :)

            – Mr.Sh4nnon
            Nov 13 '18 at 18:38





            Thank you very much! I guess I'll do it that way :)

            – Mr.Sh4nnon
            Nov 13 '18 at 18:38













            0














            $ docker attach [CONTAINER ID]


            did the job to re-enter my console over ssh. However as Clayton Harbich pointed out



            $ docker logs [OPTIONS] CONTAINER ID


            is what I needed without knowing. Re-entering the console with attach doesn't show the history of console entries. So with those two commands I was able to see what happened and can further observe the scripts process.






            share|improve this answer



























              0














              $ docker attach [CONTAINER ID]


              did the job to re-enter my console over ssh. However as Clayton Harbich pointed out



              $ docker logs [OPTIONS] CONTAINER ID


              is what I needed without knowing. Re-entering the console with attach doesn't show the history of console entries. So with those two commands I was able to see what happened and can further observe the scripts process.






              share|improve this answer

























                0












                0








                0







                $ docker attach [CONTAINER ID]


                did the job to re-enter my console over ssh. However as Clayton Harbich pointed out



                $ docker logs [OPTIONS] CONTAINER ID


                is what I needed without knowing. Re-entering the console with attach doesn't show the history of console entries. So with those two commands I was able to see what happened and can further observe the scripts process.






                share|improve this answer













                $ docker attach [CONTAINER ID]


                did the job to re-enter my console over ssh. However as Clayton Harbich pointed out



                $ docker logs [OPTIONS] CONTAINER ID


                is what I needed without knowing. Re-entering the console with attach doesn't show the history of console entries. So with those two commands I was able to see what happened and can further observe the scripts process.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 14 '18 at 9:31









                Mr.Sh4nnonMr.Sh4nnon

                6111




                6111



























                    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%2f53286438%2fhow-can-i-re-access-a-bash-console-in-a-docker%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







                    這個網誌中的熱門文章

                    How to read a connectionString WITH PROVIDER in .NET Core?

                    In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

                    Museum of Modern and Contemporary Art of Trento and Rovereto