Can't connect to docker endpoint even with docker-compose up successful











up vote
0
down vote

favorite












I am trying to learn how to containerize my flask api with docker. I am very new to docker, but from my understanding, I was able to build/update it. When I navigate to my route I get site can't be reached.



Any help would be greatly appreciated. Thank you.



Here is my yml file:



version: "3.6"
services:
users:
build:
context: ./services/users
dockerfile: Dockerfile-dev
volumes:
- "./services/users:/usr/src/app"
ports:
- 5001:5000
environment:
- FLASK_APP=project/__init__.py
- FLASK_ENV=development
- APP_SETTINGS=project.config.DevelopmentConfig


here is my dockerfile:



FROM python:3.6.5-alpine
WORKDIR /usr/src/app

COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip install -r requirements.txt

COPY . /usr/src/app

CMD python manage.py -h 0.0.0.0


and here is my powershell command and output:



docker-compose -f docker-compose-dev.yml up -d --build


enter image description here



upon further diagnosis I found this from the ps command enter image description here



I however cannot find in docker documentation what state of exit 2 means. Unless that is bash for misuse of shell builtin: http://www.tldp.org/LDP/abs/html/exitcodes.html. In that case I really don't know my problem and would appreciate any help!



Edit 3:



upon reading some github threads removing the -d flag from my command showed more information but it is still cryptic if anyone has an explanation for it:



enter image description here










share|improve this question




























    up vote
    0
    down vote

    favorite












    I am trying to learn how to containerize my flask api with docker. I am very new to docker, but from my understanding, I was able to build/update it. When I navigate to my route I get site can't be reached.



    Any help would be greatly appreciated. Thank you.



    Here is my yml file:



    version: "3.6"
    services:
    users:
    build:
    context: ./services/users
    dockerfile: Dockerfile-dev
    volumes:
    - "./services/users:/usr/src/app"
    ports:
    - 5001:5000
    environment:
    - FLASK_APP=project/__init__.py
    - FLASK_ENV=development
    - APP_SETTINGS=project.config.DevelopmentConfig


    here is my dockerfile:



    FROM python:3.6.5-alpine
    WORKDIR /usr/src/app

    COPY ./requirements.txt /usr/src/app/requirements.txt
    RUN pip install -r requirements.txt

    COPY . /usr/src/app

    CMD python manage.py -h 0.0.0.0


    and here is my powershell command and output:



    docker-compose -f docker-compose-dev.yml up -d --build


    enter image description here



    upon further diagnosis I found this from the ps command enter image description here



    I however cannot find in docker documentation what state of exit 2 means. Unless that is bash for misuse of shell builtin: http://www.tldp.org/LDP/abs/html/exitcodes.html. In that case I really don't know my problem and would appreciate any help!



    Edit 3:



    upon reading some github threads removing the -d flag from my command showed more information but it is still cryptic if anyone has an explanation for it:



    enter image description here










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am trying to learn how to containerize my flask api with docker. I am very new to docker, but from my understanding, I was able to build/update it. When I navigate to my route I get site can't be reached.



      Any help would be greatly appreciated. Thank you.



      Here is my yml file:



      version: "3.6"
      services:
      users:
      build:
      context: ./services/users
      dockerfile: Dockerfile-dev
      volumes:
      - "./services/users:/usr/src/app"
      ports:
      - 5001:5000
      environment:
      - FLASK_APP=project/__init__.py
      - FLASK_ENV=development
      - APP_SETTINGS=project.config.DevelopmentConfig


      here is my dockerfile:



      FROM python:3.6.5-alpine
      WORKDIR /usr/src/app

      COPY ./requirements.txt /usr/src/app/requirements.txt
      RUN pip install -r requirements.txt

      COPY . /usr/src/app

      CMD python manage.py -h 0.0.0.0


      and here is my powershell command and output:



      docker-compose -f docker-compose-dev.yml up -d --build


      enter image description here



      upon further diagnosis I found this from the ps command enter image description here



      I however cannot find in docker documentation what state of exit 2 means. Unless that is bash for misuse of shell builtin: http://www.tldp.org/LDP/abs/html/exitcodes.html. In that case I really don't know my problem and would appreciate any help!



      Edit 3:



      upon reading some github threads removing the -d flag from my command showed more information but it is still cryptic if anyone has an explanation for it:



      enter image description here










      share|improve this question















      I am trying to learn how to containerize my flask api with docker. I am very new to docker, but from my understanding, I was able to build/update it. When I navigate to my route I get site can't be reached.



      Any help would be greatly appreciated. Thank you.



      Here is my yml file:



      version: "3.6"
      services:
      users:
      build:
      context: ./services/users
      dockerfile: Dockerfile-dev
      volumes:
      - "./services/users:/usr/src/app"
      ports:
      - 5001:5000
      environment:
      - FLASK_APP=project/__init__.py
      - FLASK_ENV=development
      - APP_SETTINGS=project.config.DevelopmentConfig


      here is my dockerfile:



      FROM python:3.6.5-alpine
      WORKDIR /usr/src/app

      COPY ./requirements.txt /usr/src/app/requirements.txt
      RUN pip install -r requirements.txt

      COPY . /usr/src/app

      CMD python manage.py -h 0.0.0.0


      and here is my powershell command and output:



      docker-compose -f docker-compose-dev.yml up -d --build


      enter image description here



      upon further diagnosis I found this from the ps command enter image description here



      I however cannot find in docker documentation what state of exit 2 means. Unless that is bash for misuse of shell builtin: http://www.tldp.org/LDP/abs/html/exitcodes.html. In that case I really don't know my problem and would appreciate any help!



      Edit 3:



      upon reading some github threads removing the -d flag from my command showed more information but it is still cryptic if anyone has an explanation for it:



      enter image description here







      docker docker-compose






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 5 at 4:30

























      asked Nov 5 at 3:16









      stegnerd

      227




      227
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          I guess new flask versions doesn't support -h anymore, try with --host -



          Change CMD statement in Dockerfile to -



          CMD python manage.py runserver --host 0.0.0.0



          Ref - https://flask-script.readthedocs.io/en/latest/






          share|improve this answer





















          • runserver didn't work for me, the final answer was CMD python manage.py run --host 0.0.0.0 . I will go ahead an mark your's as the answer since it lead to my solution! thanks:)
            – stegnerd
            Nov 6 at 0:09













          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',
          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%2f53147858%2fcant-connect-to-docker-endpoint-even-with-docker-compose-up-successful%23new-answer', 'question_page');
          }
          );

          Post as a guest
































          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          I guess new flask versions doesn't support -h anymore, try with --host -



          Change CMD statement in Dockerfile to -



          CMD python manage.py runserver --host 0.0.0.0



          Ref - https://flask-script.readthedocs.io/en/latest/






          share|improve this answer





















          • runserver didn't work for me, the final answer was CMD python manage.py run --host 0.0.0.0 . I will go ahead an mark your's as the answer since it lead to my solution! thanks:)
            – stegnerd
            Nov 6 at 0:09

















          up vote
          1
          down vote



          accepted










          I guess new flask versions doesn't support -h anymore, try with --host -



          Change CMD statement in Dockerfile to -



          CMD python manage.py runserver --host 0.0.0.0



          Ref - https://flask-script.readthedocs.io/en/latest/






          share|improve this answer





















          • runserver didn't work for me, the final answer was CMD python manage.py run --host 0.0.0.0 . I will go ahead an mark your's as the answer since it lead to my solution! thanks:)
            – stegnerd
            Nov 6 at 0:09















          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          I guess new flask versions doesn't support -h anymore, try with --host -



          Change CMD statement in Dockerfile to -



          CMD python manage.py runserver --host 0.0.0.0



          Ref - https://flask-script.readthedocs.io/en/latest/






          share|improve this answer












          I guess new flask versions doesn't support -h anymore, try with --host -



          Change CMD statement in Dockerfile to -



          CMD python manage.py runserver --host 0.0.0.0



          Ref - https://flask-script.readthedocs.io/en/latest/







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 5 at 5:00









          vivekyad4v

          2,78021324




          2,78021324












          • runserver didn't work for me, the final answer was CMD python manage.py run --host 0.0.0.0 . I will go ahead an mark your's as the answer since it lead to my solution! thanks:)
            – stegnerd
            Nov 6 at 0:09




















          • runserver didn't work for me, the final answer was CMD python manage.py run --host 0.0.0.0 . I will go ahead an mark your's as the answer since it lead to my solution! thanks:)
            – stegnerd
            Nov 6 at 0:09


















          runserver didn't work for me, the final answer was CMD python manage.py run --host 0.0.0.0 . I will go ahead an mark your's as the answer since it lead to my solution! thanks:)
          – stegnerd
          Nov 6 at 0:09






          runserver didn't work for me, the final answer was CMD python manage.py run --host 0.0.0.0 . I will go ahead an mark your's as the answer since it lead to my solution! thanks:)
          – stegnerd
          Nov 6 at 0:09




















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53147858%2fcant-connect-to-docker-endpoint-even-with-docker-compose-up-successful%23new-answer', 'question_page');
          }
          );

          Post as a guest




















































































          這個網誌中的熱門文章

          Tangent Lines Diagram Along Smooth Curve

          Yusuf al-Mu'taman ibn Hud

          Zucchini