Featuring:
- Docker v18.09.2
- Docker Compose v1.23.2
- Docker Machine v0.16.1
Check out the awesome blog post here > https://realpython.com/blog/python/dockerizing-flask-with-compose-and-machine-from-localhost-to-the-cloud/
Cheers!
Featuring:
Check out the awesome blog post here > https://realpython.com/blog/python/dockerizing-flask-with-compose-and-machine-from-localhost-to-the-cloud/
Cheers!
Seems like there is a way to do this without the need of a container? Are there benefits of using a container?
CMIIW, but this is not supporting auto reload?
Great work on your article! I have followed it all the way to the end. Now, I wonder if you have any suggestions for deployment in aws beanstalk. I am particularly interested in the dockerrun.aws.json file.
i get this error while using building. kindly help.
orchestrating-docker$ docker-compose up
Building web
Step 1 : FROM python:3.4-onbuild
Step 1 : COPY requirements.txt /usr/src/app/
---> Using cache
Step 1 : RUN pip install --no-cache-dir -r requirements.txt
---> Running in 9c8b343de8e1
Collecting Flask==0.10.1 (from -r requirements.txt (line 1))
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5e2d1b00b8>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/flask/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5e2d1b0e80>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/flask/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f5e2d1b0898>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/flask/
I've been following the instructions from your tutorial and everything has (mostly) been going fine. However, when I try to create the db with docker-compose run web /usr/local/bin/python create_db.py
, it errors out with:
Traceback (most recent call last):
... MESS ...
psycopg2.OperationalError: could not translate host name "postgres" to address: Temporary failure in name resolution
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
... MESS ...
(If you need me to paste the full error, let me know)
I originally had docker-machine and docker-compose as the latest versions, but I downgraded to use the exact version in the tutorial.
$ # I am using Ubuntu 18.04
$ docker --version
Docker version 19.03.11, build 42e35e61f3
$ docker-machine --version
docker-machine version 0.16.1, build cce350d7
$ docker-compose --version
docker-compose version 1.23.2, build 1110ad01
Let me know what else you need from me and thanks for the awesome tutorial ๐
I tried to run the steps in https://realpython.com/blog/python/dockerizing-flask-with-compose-and-machine-from-localhost-to-the-cloud/ and got up to step "build the images and then start the services"
docker-compose build fails with ERROR
SSL error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
I have Docker Toolbox on my notebook (Windows), installed yesterday
up and running
$ docker-machine --version
docker-machine.exe version 0.6.0, build e27fb87
$ docker-compose --version
docker-compose version 1.6.2, build e80fc83
$ docker --version
Docker version 1.10.3, build 20f81dd
Ultimately during the docker-compose up
call, the data container exits and causes the other 3 containers to shutdown:
orchestratingdocker_data_1 exited with code 0
Gracefully stopping... (press Ctrl+C again to force)
Stopping orchestratingdocker_nginx_1... done
Stopping orchestratingdocker_web_1... done
Stopping orchestratingdocker_postgres_1... done
Stopping orchestratingdocker_data_1... done
I haven't altered any of the code from the repo. It works fine if I comment out the data container and the relevant lines from the postgres container.
I'm on a mac. Here are the versions if it helps:
$ docker-machine --version
docker-machine version 0.4.1 (e2c88d6)
$ docker -v
Docker version 1.8.1, build d12ea79
$ docker-compose --version
docker-compose version: 1.4.0
Seems like everything is working. So why does this fail? I don't even know where to begin debugging this.
docker-compose run web env Alex@Maxs-MacBook-Pro-3
Starting orchestratingdocker_data_1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=b545383099a0
TERM=xterm
WEB_1_PORT=tcp://172.17.0.2:8000
WEB_1_PORT_8000_TCP=tcp://172.17.0.2:8000
WEB_1_PORT_8000_TCP_ADDR=172.17.0.2
WEB_1_PORT_8000_TCP_PORT=8000
WEB_1_PORT_8000_TCP_PROTO=tcp
WEB_1_NAME=/orchestratingdocker_web_run_3/web_1
WEB_1_ENV_DB_PASS=postgres
WEB_1_ENV_DB_NAME=postgres
WEB_1_ENV_DB_USER=postgres
WEB_1_ENV_DB_SERVICE=postgres
WEB_1_ENV_SECRET_KEY=5(15ds+i2+%ik6z&!yer+ga9m=e%jcqiz_5wszg)r-z!2--b2d
WEB_1_ENV_DEBUG=False
WEB_1_ENV_DB_PORT=5432
WEB_1_ENV_LANG=C.UTF-8
WEB_1_ENV_GPG_KEY=97FC712E4C024BBEA48A61ED3A5CA953F73C700D
WEB_1_ENV_PYTHON_VERSION=3.4.4
WEB_1_ENV_PYTHON_PIP_VERSION=8.1.1
ORCHESTRATINGDOCKER_POSTGRES_1_PORT=tcp://172.17.0.3:5432
ORCHESTRATINGDOCKER_POSTGRES_1_PORT_5432_TCP=tcp://172.17.0.3:5432
ORCHESTRATINGDOCKER_POSTGRES_1_PORT_5432_TCP_ADDR=172.17.0.3
ORCHESTRATINGDOCKER_POSTGRES_1_PORT_5432_TCP_PORT=5432
ORCHESTRATINGDOCKER_POSTGRES_1_PORT_5432_TCP_PROTO=tcp
ORCHESTRATINGDOCKER_POSTGRES_1_NAME=/orchestratingdocker_web_run_3/orchestratingdocker_postgres_1
ORCHESTRATINGDOCKER_POSTGRES_1_ENV_GOSU_VERSION=1.7
ORCHESTRATINGDOCKER_POSTGRES_1_ENV_LANG=en_US.utf8
ORCHESTRATINGDOCKER_POSTGRES_1_ENV_PG_MAJOR=9.5
ORCHESTRATINGDOCKER_POSTGRES_1_ENV_PG_VERSION=9.5.2-1.pgdg80+1
ORCHESTRATINGDOCKER_POSTGRES_1_ENV_PGDATA=/var/lib/postgresql/data
POSTGRES_PORT=tcp://172.17.0.3:5432
POSTGRES_PORT_5432_TCP=tcp://172.17.0.3:5432
POSTGRES_PORT_5432_TCP_ADDR=172.17.0.3
POSTGRES_PORT_5432_TCP_PORT=5432
POSTGRES_PORT_5432_TCP_PROTO=tcp
POSTGRES_NAME=/orchestratingdocker_web_run_3/postgres
POSTGRES_ENV_GOSU_VERSION=1.7
POSTGRES_ENV_LANG=en_US.utf8
POSTGRES_ENV_PG_MAJOR=9.5
POSTGRES_ENV_PG_VERSION=9.5.2-1.pgdg80+1
POSTGRES_ENV_PGDATA=/var/lib/postgresql/data
POSTGRES_1_PORT=tcp://172.17.0.3:5432
POSTGRES_1_PORT_5432_TCP=tcp://172.17.0.3:5432
POSTGRES_1_PORT_5432_TCP_ADDR=172.17.0.3
POSTGRES_1_PORT_5432_TCP_PORT=5432
POSTGRES_1_PORT_5432_TCP_PROTO=tcp
POSTGRES_1_NAME=/orchestratingdocker_web_run_3/postgres_1
POSTGRES_1_ENV_GOSU_VERSION=1.7
POSTGRES_1_ENV_LANG=en_US.utf8
POSTGRES_1_ENV_PG_MAJOR=9.5
POSTGRES_1_ENV_PG_VERSION=9.5.2-1.pgdg80+1
POSTGRES_1_ENV_PGDATA=/var/lib/postgresql/data
ORCHESTRATINGDOCKER_WEB_1_PORT=tcp://172.17.0.2:8000
ORCHESTRATINGDOCKER_WEB_1_PORT_8000_TCP=tcp://172.17.0.2:8000
ORCHESTRATINGDOCKER_WEB_1_PORT_8000_TCP_ADDR=172.17.0.2
ORCHESTRATINGDOCKER_WEB_1_PORT_8000_TCP_PORT=8000
ORCHESTRATINGDOCKER_WEB_1_PORT_8000_TCP_PROTO=tcp
ORCHESTRATINGDOCKER_WEB_1_NAME=/orchestratingdocker_web_run_3/orchestratingdocker_web_1
ORCHESTRATINGDOCKER_WEB_1_ENV_DB_PASS=postgres
ORCHESTRATINGDOCKER_WEB_1_ENV_DB_NAME=postgres
ORCHESTRATINGDOCKER_WEB_1_ENV_DB_USER=postgres
ORCHESTRATINGDOCKER_WEB_1_ENV_DB_SERVICE=postgres
ORCHESTRATINGDOCKER_WEB_1_ENV_SECRET_KEY=5(15ds+i2+%ik6z&!yer+ga9m=e%jcqiz_5wszg)r-z!2--b2d
ORCHESTRATINGDOCKER_WEB_1_ENV_DEBUG=False
ORCHESTRATINGDOCKER_WEB_1_ENV_DB_PORT=5432
ORCHESTRATINGDOCKER_WEB_1_ENV_LANG=C.UTF-8
ORCHESTRATINGDOCKER_WEB_1_ENV_GPG_KEY=97FC712E4C024BBEA48A61ED3A5CA953F73C700D
ORCHESTRATINGDOCKER_WEB_1_ENV_PYTHON_VERSION=3.4.4
ORCHESTRATINGDOCKER_WEB_1_ENV_PYTHON_PIP_VERSION=8.1.1
WEB_PORT=tcp://172.17.0.2:8000
WEB_PORT_8000_TCP=tcp://172.17.0.2:8000
WEB_PORT_8000_TCP_ADDR=172.17.0.2
WEB_PORT_8000_TCP_PORT=8000
WEB_PORT_8000_TCP_PROTO=tcp
WEB_NAME=/orchestratingdocker_web_run_3/web
WEB_ENV_DB_PASS=postgres
WEB_ENV_DB_NAME=postgres
WEB_ENV_DB_USER=postgres
WEB_ENV_DB_SERVICE=postgres
WEB_ENV_SECRET_KEY=5(15ds+i2+%ik6z&!yer+ga9m=e%jcqiz_5wszg)r-z!2--b2d
WEB_ENV_DEBUG=False
WEB_ENV_DB_PORT=5432
WEB_ENV_LANG=C.UTF-8
WEB_ENV_GPG_KEY=97FC712E4C024BBEA48A61ED3A5CA953F73C700D
WEB_ENV_PYTHON_VERSION=3.4.4
WEB_ENV_PYTHON_PIP_VERSION=8.1.1
DB_PASS=postgres
DB_NAME=postgres
DB_USER=postgres
DB_SERVICE=postgres
SECRET_KEY=5(15ds+i2+%ik6z&!yer+ga9m=e%jcqiz_5wszg)r-z!2--b2d
DEBUG=False
DB_PORT=5432
LANG=C.UTF-8
GPG_KEY=97FC712E4C024BBEA48A61ED3A5CA953F73C700D
PYTHON_VERSION=3.4.4
PYTHON_PIP_VERSION=8.1.1
HOME=/root
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.