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
upon further diagnosis I found this from the ps command
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:
docker docker-compose
add a comment |
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
upon further diagnosis I found this from the ps command
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:
docker docker-compose
add a comment |
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
upon further diagnosis I found this from the ps command
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:
docker docker-compose
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
upon further diagnosis I found this from the ps command
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:
docker docker-compose
docker docker-compose
edited Nov 5 at 4:30
asked Nov 5 at 3:16
stegnerd
227
227
add a comment |
add a comment |
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/
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
add a comment |
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/
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
add a comment |
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/
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
add a comment |
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/
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/
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
add a comment |
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
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password