How can i use exec for contrainer bash when the container won't start in Docker?How do I edit a file after I shell to a Docker container?How to list containers in DockerHow to remove old Docker containersHow to mount a host directory in a Docker containerFrom inside of a Docker container, how do I connect to the localhost of the machine?How to upgrade docker container after its image changedHow do I pass environment variables to Docker containers?Deploying docker on AWS Beanstalk only serves html files, no other filesDocker PHP-APACHE container set the ServerName directive globallyUnable to open primary script (Permission denied)docker image for php is not working on browser for windows 10

Is there a word for food that's gone 'bad', but is still edible?

What is a common way to tell if an academic is "above average," or outstanding in their field? Is their h-index (Hirsh index) one of them?

Why does sound not move through a wall?

Why didn't this character get a funeral at the end of Avengers: Endgame?

Gerrymandering Puzzle - Rig the Election

Out of scope work duties and resignation

Endgame puzzle: How to avoid stalemate and win?

Is it normal for gliders not to have attitude indicators?

What do "Sech" and "Vich" mean in this sentence?

How can internet speed be 10 times slower without a router than when using a router?

Is there an age requirement to play in Adventurers League?

How to deal with employer who keeps me at work after working hours

Is 'contemporary' ambiguous and if so is there a better word?

Can there be a single technologically advanced nation, in a continent full of non-technologically advanced nations?

Find magical solution to magical equation

Is an HNN extension of a virtually torsion-free group virtually torsion-free?

Why would a military not separate its forces into different branches?

Prove that a definite integral is an infinite sum

To kill a cuckoo

Is “snitty” a popular American English term? What is its origin?

How to ask systemd to not start a system service on boot?

How long would it take for people to notice a mass disappearance?

Is disk brake effectiveness mitigated by tyres losing traction under strong braking?

Will 700 more planes a day fly because of the Heathrow expansion?



How can i use exec for contrainer bash when the container won't start in Docker?


How do I edit a file after I shell to a Docker container?How to list containers in DockerHow to remove old Docker containersHow to mount a host directory in a Docker containerFrom inside of a Docker container, how do I connect to the localhost of the machine?How to upgrade docker container after its image changedHow do I pass environment variables to Docker containers?Deploying docker on AWS Beanstalk only serves html files, no other filesDocker PHP-APACHE container set the ServerName directive globallyUnable to open primary script (Permission denied)docker image for php is not working on browser for windows 10






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I tryied to run php:apache container. Then i apply the virtual host setting and exit the container bash and I used docker restart <containerid> but i couldn't start. Then i checked the logs with docker logs <containerid> and it says you have a syntax in 000-default.conf



Now that's my question: If i can't start the container how can i connect the container bash and open the 000-default.conf and fix the syntax error? Is there any other way for that?



Here is the log output:



C:UsersUtku>docker logs bb
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Sat Mar 23 01:05:26.411235 2019] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.16 configured -- resuming normal operations
[Sat Mar 23 01:05:26.411274 2019] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
[Sat Mar 23 01:05:37.388586 2019] [autoindex:error] [pid 16] [client 172.17.0.1:40982] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive
localhost:80 172.17.0.1 - - [23/Mar/2019:01:05:37 +0000] "GET / HTTP/1.1" 403 501 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
localhost:80 172.17.0.1 - - [23/Mar/2019:01:05:37 +0000] "GET /favicon.ico HTTP/1.1" 404 500 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
localhost:80 172.17.0.1 - - [23/Mar/2019:01:06:55 +0000] "GET / HTTP/1.1" 200 286 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
[Sat Mar 23 01:07:53.847828 2019] [mpm_prefork:notice] [pid 1] AH00169: caught SIGTERM, shutting down
AH00526: Syntax error on line 35 of /etc/apache2/sites-enabled/000-default.conf:
Invalid command 'sadasd', perhaps misspelled or defined by a module not included in the server configuration









share|improve this question



















  • 1





    Possible duplicate of How do I edit a file after I shell to a Docker container?

    – vfalcao
    Mar 23 at 1:01











  • Please, post the exact error logged, in order to help us help you solve your problem.

    – vfalcao
    Mar 23 at 1:02

















0















I tryied to run php:apache container. Then i apply the virtual host setting and exit the container bash and I used docker restart <containerid> but i couldn't start. Then i checked the logs with docker logs <containerid> and it says you have a syntax in 000-default.conf



Now that's my question: If i can't start the container how can i connect the container bash and open the 000-default.conf and fix the syntax error? Is there any other way for that?



Here is the log output:



C:UsersUtku>docker logs bb
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Sat Mar 23 01:05:26.411235 2019] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.16 configured -- resuming normal operations
[Sat Mar 23 01:05:26.411274 2019] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
[Sat Mar 23 01:05:37.388586 2019] [autoindex:error] [pid 16] [client 172.17.0.1:40982] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive
localhost:80 172.17.0.1 - - [23/Mar/2019:01:05:37 +0000] "GET / HTTP/1.1" 403 501 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
localhost:80 172.17.0.1 - - [23/Mar/2019:01:05:37 +0000] "GET /favicon.ico HTTP/1.1" 404 500 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
localhost:80 172.17.0.1 - - [23/Mar/2019:01:06:55 +0000] "GET / HTTP/1.1" 200 286 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
[Sat Mar 23 01:07:53.847828 2019] [mpm_prefork:notice] [pid 1] AH00169: caught SIGTERM, shutting down
AH00526: Syntax error on line 35 of /etc/apache2/sites-enabled/000-default.conf:
Invalid command 'sadasd', perhaps misspelled or defined by a module not included in the server configuration









share|improve this question



















  • 1





    Possible duplicate of How do I edit a file after I shell to a Docker container?

    – vfalcao
    Mar 23 at 1:01











  • Please, post the exact error logged, in order to help us help you solve your problem.

    – vfalcao
    Mar 23 at 1:02













0












0








0








I tryied to run php:apache container. Then i apply the virtual host setting and exit the container bash and I used docker restart <containerid> but i couldn't start. Then i checked the logs with docker logs <containerid> and it says you have a syntax in 000-default.conf



Now that's my question: If i can't start the container how can i connect the container bash and open the 000-default.conf and fix the syntax error? Is there any other way for that?



Here is the log output:



C:UsersUtku>docker logs bb
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Sat Mar 23 01:05:26.411235 2019] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.16 configured -- resuming normal operations
[Sat Mar 23 01:05:26.411274 2019] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
[Sat Mar 23 01:05:37.388586 2019] [autoindex:error] [pid 16] [client 172.17.0.1:40982] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive
localhost:80 172.17.0.1 - - [23/Mar/2019:01:05:37 +0000] "GET / HTTP/1.1" 403 501 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
localhost:80 172.17.0.1 - - [23/Mar/2019:01:05:37 +0000] "GET /favicon.ico HTTP/1.1" 404 500 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
localhost:80 172.17.0.1 - - [23/Mar/2019:01:06:55 +0000] "GET / HTTP/1.1" 200 286 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
[Sat Mar 23 01:07:53.847828 2019] [mpm_prefork:notice] [pid 1] AH00169: caught SIGTERM, shutting down
AH00526: Syntax error on line 35 of /etc/apache2/sites-enabled/000-default.conf:
Invalid command 'sadasd', perhaps misspelled or defined by a module not included in the server configuration









share|improve this question
















I tryied to run php:apache container. Then i apply the virtual host setting and exit the container bash and I used docker restart <containerid> but i couldn't start. Then i checked the logs with docker logs <containerid> and it says you have a syntax in 000-default.conf



Now that's my question: If i can't start the container how can i connect the container bash and open the 000-default.conf and fix the syntax error? Is there any other way for that?



Here is the log output:



C:UsersUtku>docker logs bb
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Sat Mar 23 01:05:26.411235 2019] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.16 configured -- resuming normal operations
[Sat Mar 23 01:05:26.411274 2019] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
[Sat Mar 23 01:05:37.388586 2019] [autoindex:error] [pid 16] [client 172.17.0.1:40982] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive
localhost:80 172.17.0.1 - - [23/Mar/2019:01:05:37 +0000] "GET / HTTP/1.1" 403 501 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
localhost:80 172.17.0.1 - - [23/Mar/2019:01:05:37 +0000] "GET /favicon.ico HTTP/1.1" 404 500 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
localhost:80 172.17.0.1 - - [23/Mar/2019:01:06:55 +0000] "GET / HTTP/1.1" 200 286 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
[Sat Mar 23 01:07:53.847828 2019] [mpm_prefork:notice] [pid 1] AH00169: caught SIGTERM, shutting down
AH00526: Syntax error on line 35 of /etc/apache2/sites-enabled/000-default.conf:
Invalid command 'sadasd', perhaps misspelled or defined by a module not included in the server configuration






docker






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 1:09







Utku Altaş

















asked Mar 23 at 0:54









Utku AltaşUtku Altaş

183




183







  • 1





    Possible duplicate of How do I edit a file after I shell to a Docker container?

    – vfalcao
    Mar 23 at 1:01











  • Please, post the exact error logged, in order to help us help you solve your problem.

    – vfalcao
    Mar 23 at 1:02












  • 1





    Possible duplicate of How do I edit a file after I shell to a Docker container?

    – vfalcao
    Mar 23 at 1:01











  • Please, post the exact error logged, in order to help us help you solve your problem.

    – vfalcao
    Mar 23 at 1:02







1




1





Possible duplicate of How do I edit a file after I shell to a Docker container?

– vfalcao
Mar 23 at 1:01





Possible duplicate of How do I edit a file after I shell to a Docker container?

– vfalcao
Mar 23 at 1:01













Please, post the exact error logged, in order to help us help you solve your problem.

– vfalcao
Mar 23 at 1:02





Please, post the exact error logged, in order to help us help you solve your problem.

– vfalcao
Mar 23 at 1:02












2 Answers
2






active

oldest

votes


















0














EDIT: docker cp should also works on stopped container, you can copy the config file out of the container, edit it, and copy back.



Yes, but you need to create an image from this container and run it:



  1. use docker ps -a to find the failed container's id, for example: d391b29f5526.

  2. run docker commit d391b29f5526 test-image to create a image from this container.


  3. docker run -it --entrypoint bash test-image and do your edit.

  4. commit the container created from step 3 to an image and run it.





share|improve this answer
































    0














    Try the following:



    docker cp bb:/etc/apache2/sites-enabled/000-default.conf /tmp/000-default.conf


    now, edit your /tmp/000-default.conf (on your docker host) and remove this
    sadasd on your line 35, as said in the log;



    after editing, copy back the file to the container:



    docker cp /tmp/000-default.conf bb:/etc/apache2/sites-enabled/000-default.conf


    If your conf files are error free, now you should be able to restart your container.






    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%2f55309575%2fhow-can-i-use-exec-for-contrainer-bash-when-the-container-wont-start-in-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









      0














      EDIT: docker cp should also works on stopped container, you can copy the config file out of the container, edit it, and copy back.



      Yes, but you need to create an image from this container and run it:



      1. use docker ps -a to find the failed container's id, for example: d391b29f5526.

      2. run docker commit d391b29f5526 test-image to create a image from this container.


      3. docker run -it --entrypoint bash test-image and do your edit.

      4. commit the container created from step 3 to an image and run it.





      share|improve this answer





























        0














        EDIT: docker cp should also works on stopped container, you can copy the config file out of the container, edit it, and copy back.



        Yes, but you need to create an image from this container and run it:



        1. use docker ps -a to find the failed container's id, for example: d391b29f5526.

        2. run docker commit d391b29f5526 test-image to create a image from this container.


        3. docker run -it --entrypoint bash test-image and do your edit.

        4. commit the container created from step 3 to an image and run it.





        share|improve this answer



























          0












          0








          0







          EDIT: docker cp should also works on stopped container, you can copy the config file out of the container, edit it, and copy back.



          Yes, but you need to create an image from this container and run it:



          1. use docker ps -a to find the failed container's id, for example: d391b29f5526.

          2. run docker commit d391b29f5526 test-image to create a image from this container.


          3. docker run -it --entrypoint bash test-image and do your edit.

          4. commit the container created from step 3 to an image and run it.





          share|improve this answer















          EDIT: docker cp should also works on stopped container, you can copy the config file out of the container, edit it, and copy back.



          Yes, but you need to create an image from this container and run it:



          1. use docker ps -a to find the failed container's id, for example: d391b29f5526.

          2. run docker commit d391b29f5526 test-image to create a image from this container.


          3. docker run -it --entrypoint bash test-image and do your edit.

          4. commit the container created from step 3 to an image and run it.






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 23 at 1:34

























          answered Mar 23 at 1:06









          tsl0922tsl0922

          42736




          42736























              0














              Try the following:



              docker cp bb:/etc/apache2/sites-enabled/000-default.conf /tmp/000-default.conf


              now, edit your /tmp/000-default.conf (on your docker host) and remove this
              sadasd on your line 35, as said in the log;



              after editing, copy back the file to the container:



              docker cp /tmp/000-default.conf bb:/etc/apache2/sites-enabled/000-default.conf


              If your conf files are error free, now you should be able to restart your container.






              share|improve this answer



























                0














                Try the following:



                docker cp bb:/etc/apache2/sites-enabled/000-default.conf /tmp/000-default.conf


                now, edit your /tmp/000-default.conf (on your docker host) and remove this
                sadasd on your line 35, as said in the log;



                after editing, copy back the file to the container:



                docker cp /tmp/000-default.conf bb:/etc/apache2/sites-enabled/000-default.conf


                If your conf files are error free, now you should be able to restart your container.






                share|improve this answer

























                  0












                  0








                  0







                  Try the following:



                  docker cp bb:/etc/apache2/sites-enabled/000-default.conf /tmp/000-default.conf


                  now, edit your /tmp/000-default.conf (on your docker host) and remove this
                  sadasd on your line 35, as said in the log;



                  after editing, copy back the file to the container:



                  docker cp /tmp/000-default.conf bb:/etc/apache2/sites-enabled/000-default.conf


                  If your conf files are error free, now you should be able to restart your container.






                  share|improve this answer













                  Try the following:



                  docker cp bb:/etc/apache2/sites-enabled/000-default.conf /tmp/000-default.conf


                  now, edit your /tmp/000-default.conf (on your docker host) and remove this
                  sadasd on your line 35, as said in the log;



                  after editing, copy back the file to the container:



                  docker cp /tmp/000-default.conf bb:/etc/apache2/sites-enabled/000-default.conf


                  If your conf files are error free, now you should be able to restart your container.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 23 at 2:24









                  vfalcaovfalcao

                  136211




                  136211



























                      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%2f55309575%2fhow-can-i-use-exec-for-contrainer-bash-when-the-container-wont-start-in-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







                      Popular posts from this blog

                      Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

                      밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

                      1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴