Bitbucket pipeline with docker and mysql - mysql

I want to implement some CI/CD for a Django web using the bitbucket pipeline. The goal is: Test the Docker builds correctly and next run Django test.
But I get this error:
django.db.utils.OperationalError: (2003, 'Can\'t connect to MySQL server on \'127.0.0.1\' (111 "Connection refused")')
Here is the bitbucket-pipelines.yml:
options:
docker: true
definitions:
services:
mysql:
image: mysql:5.7
variables:
MYSQL_DATABASE: 'foo'
MYSQL_USER: 'default'
MYSQL_PASSWORD: 'default'
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
steps:
- step: &test-docker
name: "docker builds"
services:
- docker
- mysql
caches:
- docker
script:
- export IMAGE_NAME=foo:$BITBUCKET_COMMIT
- export CONTAINER_NAME=test-foo
- docker build -t $IMAGE_NAME .
- docker run -p 8080:8080 --name $CONTAINER_NAME --rm -d $IMAGE_NAME
- docker exec $CONTAINER_NAME python /app/manage.py test tests --noinput
- docker stop $CONTAINER_NAME
pipelines:
default:
- step: *test-docker
I already tried some solutions and workarounds like. Linking the ports from the services and the docker; using volumes; and test the Django outside docker. This one have more problems because it needs 2 DB (original and test) and a user with full access, and using the entrypoint didn't work.

The database address specified in your django application i.e., 127.0.0.1 only works if you have mysql running in you local system and not the container.
As you are using a docker image of mysql, it has it's own IP address and not 127.0.0.1. You can use docker inspect <container id> to get the IP address.
check this in you django settings.py file:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'foo',
'USER': 'default',
'PASSWORD': 'default',
'HOST': <mysql_ip>, #this is 127.0.0.1 in your case
'PORT': '3306',
}
}
If you are internally using docker services through docker-compose, you can simply access the mysql container using it's service name in the yml file.

Related

dockerized django application cannot connect to mysql server on localhost

I have a Dockerized django application I am running and I am trying to connect it to a mysql server I have that is port forwarded from another docker container. I have done a sanity test already and confirmed that I can connect to my mysql server using mysql workbench on my localhost.
I have my dockerized django application running on network_mode: host so I thought I would be able to simply connect. Sadly I currently error out on docker-compose build with the error django.db.utils.OperationalError: (2002, "Can't connect to MySQL server on '127.0.0.1' (115)")
An accepted resolution to this issue means that my dockerized django application would be able to connect successfully to my mysql server running localhost:29998
SETTINGS.PY (Django Application)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mytestdb',
'USER': 'userone',
'PASSWORD': 'password',
'HOST': '127.0.0.1',
'PORT': '29998',
}
}
DJANGO App compose file
version: '3.3'
services:
mydjangoapp:
container_name: mydjangoapp
restart: always
env_file: .env
build: .
volumes:
- ./apps:/apps
- ./core:/core
network_mode: host
Django app dockerfile:
FROM python:3.9
COPY . .
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
COPY requirements.txt .
# install python dependencies
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# running migrations
RUN python manage.py migrate
# gunicorn
CMD ["gunicorn", "--config", "gunicorn-cfg.py", "core.wsgi"]
Dockerized mysql server (port forwarded to localhost)
version: '3.3'
services:
mysql:
image: mysql:latest
container_name: mymysqlserver
environment:
- MYSQL_DATABASE=mytestdb
- MYSQL_USER=userone
- MYSQL_ROOT_PASSWORD=password
- MYSQL_PASSWORD=password
ports:
- 29998:3306
Do I need to create some sort of docker network / bridge for this to work? (never tried that before).
I have already attempted the following solutions: sol1 (network_mode=host), sol2,
You django app is not working because:
You are running the containers in separated docker-compose files, this causes django container runs in different network than mysql container.
You are trying to connect to localhost (127.0.0.1) inside the django container. This localhost is different to 'localhost' of your computer and is different to the 'localhost' of mysql container. There are 3 different networks. If you want to connect django container with mysql container use the same network (docker network or your computer IP assigned by a router also will works).
You are trying to connect to the exposed port 29998, but this port is exposed from mysql container to your computer. If you are trying to make an internal connection you should use 3306. (If you are using an internal connection, then you don't need to expose the port)
Why not put the two services in same docker compose file and run it from there, like this:
version: '3.3'
services:
mydjangoapp:
container_name: mydjangoapp
restart: always
env_file: .env
build: .
volumes:
- ./apps:/apps
- ./core:/core
network_mode: host
depends_on: mysql
mysql:
image: mysql:latest
container_name: mymysqlserver
environment:
- MYSQL_DATABASE=mytestdb
- MYSQL_USER=userone
- MYSQL_ROOT_PASSWORD=password
- MYSQL_PASSWORD=password
ports:
- 29998:3306
And then update the settings like this:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mytestdb',
'USER': 'userone',
'PASSWORD': 'password',
'HOST': 'mysql',
'PORT': '3306',
}
}
In that way, the communication between Django and MySQL will be done through docker network, rather than accessing the host machine network.
Apart from that, you need to change the Dockerfile, so that the migration runs after the MySQL server is running. To ensure that, you can add the migration command in the CMD part:
CMD ["sh", "-c", "python manage.py migrate;gunicorn --config gunicorn-cfg.py core.wsgi"]

docker mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) [duplicate]

I've been following with the docker-compose tutorial here (linking django and postgres container). Although I was able to go through with the tutorial I'm however not able to proceed with repeating the same
using a mysql container.
The following are my dockerfile and docker-compose.yml
`
db:
image: mysql
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
links:
- db:db
`
dockerfile
FROM python:2.7
RUN mkdir /code
WORKDIR /code
RUN pip install mysql-python
RUN pip install django
They both build fine when I do docker-compose up but it seems the db environment variables are not passed to the django container since when I run os.environ.keys() in one of my django views I can't see any of the expected DB_* environment variables.
So does mysql require a different setup or am I missing something.
Thank you.
[EDIT]
Docker compose version
docker-compose version: 1.3.0
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
Docker version
Docker version 1.6.2, build 7c8fca2
In Django settings.py file make sure you have something like:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'django1',
'USER': 'django',
'PASSWORD': 'password',
'HOST': 'db',
'PORT': 3306,
}
}
then in your docker-compose.yml file make sure you have something along the lines of:
db:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: docker
MYSQL_DATABASE: docker
MYSQL_USER: docker
MYSQL_PASSWORD: docker
then as per the docker/django tutorial you are following run the following again to rebuild everything and things should start working
docker-compose run web django-admin.py startproject composeexample .
In response to a further question, the mysql root password variable is required by docker when creating new databases.
EDIT: added run to docker-compose above; see edit comment
you don't need to worry about environment variable. When linking containers together you just use the container alias defined by the link as if it was the hostname.
for instance if your docker-compose.yml file were:
db:
image: postgres
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
links:
- db:mydb
In your django settings you would have to set the database host to mydb.
First you need to modify the settings file...
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'postgres',
'USER': 'postgres',
'HOST': 'db',
'PORT': 5432,
} }
Then if you used the docker-compose command properly, the containers should be linked, and it should resolve the hostname db properly based on the links in the docker-compose.yml file.
Still, if you want to check the environment...
~/django-example: docker-compose run web env
Starting djangoexample_db_1...
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=66ff09ed8632
TERM=xterm
DJANGOEXAMPLE_DB_1_PORT=tcp://172.17.0.35:5432
DJANGOEXAMPLE_DB_1_PORT_5432_TCP=tcp://172.17.0.35:5432
DJANGOEXAMPLE_DB_1_PORT_5432_TCP_ADDR=172.17.0.35
DJANGOEXAMPLE_DB_1_PORT_5432_TCP_PORT=5432
DJANGOEXAMPLE_DB_1_PORT_5432_TCP_PROTO=tcp
DJANGOEXAMPLE_DB_1_NAME=/djangoexample_web_run_2/djangoexample_db_1
DJANGOEXAMPLE_DB_1_ENV_affinity:container==52c78c810792b0e7b9a231eab7ab7a3d50c95b76faf0abb8ec38a7d1ff0c7e5f
DJANGOEXAMPLE_DB_1_ENV_LANG=en_US.utf8
DJANGOEXAMPLE_DB_1_ENV_PG_MAJOR=9.4
DJANGOEXAMPLE_DB_1_ENV_PG_VERSION=9.4.4-1.pgdg70+1
DJANGOEXAMPLE_DB_1_ENV_PGDATA=/var/lib/postgresql/data
DB_PORT=tcp://172.17.0.35:5432
DB_PORT_5432_TCP=tcp://172.17.0.35:5432
DB_PORT_5432_TCP_ADDR=172.17.0.35
DB_PORT_5432_TCP_PORT=5432
DB_PORT_5432_TCP_PROTO=tcp
DB_NAME=/djangoexample_web_run_2/db
DB_ENV_affinity:container==52c78c810792b0e7b9a231eab7ab7a3d50c95b76faf0abb8ec38a7d1ff0c7e5f
DB_ENV_LANG=en_US.utf8
DB_ENV_PG_MAJOR=9.4
DB_ENV_PG_VERSION=9.4.4-1.pgdg70+1
DB_ENV_PGDATA=/var/lib/postgresql/data
DB_1_PORT=tcp://172.17.0.35:5432
DB_1_PORT_5432_TCP=tcp://172.17.0.35:5432
DB_1_PORT_5432_TCP_ADDR=172.17.0.35
DB_1_PORT_5432_TCP_PORT=5432
DB_1_PORT_5432_TCP_PROTO=tcp
DB_1_NAME=/djangoexample_web_run_2/db_1
DB_1_ENV_affinity:container==52c78c810792b0e7b9a231eab7ab7a3d50c95b76faf0abb8ec38a7d1ff0c7e5f
DB_1_ENV_LANG=en_US.utf8
DB_1_ENV_PG_MAJOR=9.4
DB_1_ENV_PG_VERSION=9.4.4-1.pgdg70+1
DB_1_ENV_PGDATA=/var/lib/postgresql/data
LANG=C.UTF-8
PYTHON_VERSION=2.7.10
PYTHON_PIP_VERSION=7.0.3
PYTHONUNBUFFERED=1
HOME=/root

Got an error creating the test database - django, docker, mysql

I have an issue with creating test database. I use mysql for db and docker compose.
I have no problem running docker containers with docker-compose, but when I run test it spits this error message.
Note that the name of django service is web, and mysql service is db.
$ docker-compose run --rm web sh -c "python manage.py test"
Creating sociallogin_web_run ... done
Creating test database for alias 'default'...
Got an error creating the test database: (1044, "Access denied for user 'myuser'#'%' to database 'test_mydb'")
my docker-compose.yml:
version: "3.9"
services:
db:
image: mysql:8
env_file:
- .env
command:
- --default-authentication-plugin=mysql_native_password
restart: always
# ports:
# - "3306:3306"
# volumes:
# - data:/var/lib/mysql
web:
build: .
command: >
sh -c "python manage.py wait_for_db &&
python manage.py makemigrations &&
python manage.py migrate &&
python manage.py runserver 0.0.0.0:8000"
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
env_file:
- .env
# volumes:
# data:
my .env file looks like this:
MYSQL_ROOT_PASSWORD=rootpass
MYSQL_USER=exampleuser
MYSQL_PASSWORD=examplepass
MYSQL_DATABASE=exampledb
MYSQL_PORT=3306
SECRET_KEY=exmaple_random_characters
DATABASES in settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': os.environ.get('MYSQL_DATABASE'),
'USER': os.environ.get('MYSQL_USER'),
'PASSWORD': os.environ.get('MYSQL_PASSWORD'),
'PORT': os.environ.get('MYSQL_PORT'),
'HOST': 'db',
'TEST': {
'NAME': 'test_mydb',
}
}
}
I looked at this, and I even tried this. It didn't help me.
Anyone who's been stuck at similiar problem?
Thanks guys in advance.
As K.D Singh mentioned, It was indeed mysql user permission problem.
In short, use root user when initializing mysql container.
Not sure what keeps making separate user from making test though. Because mysql docker hub says
MYSQL_USER, MYSQL_PASSWORD
These variables are optional, used in conjunction to create a new user and to set that user's password. This user will be granted superuser permissions (see above) for the database specified by the MYSQL_DATABASE variable. Both variables are required for a user to be created.
, doesn't this mean if I create user and password then it has superuser permissions like creating database as well? Not sure why it has permission issue.
Anyway, below is what I changed.
Do note that there is no need to use this mechanism to create the root superuser, that user gets created by default with the password specified by the MYSQL_ROOT_PASSWORD variable.
I changed my DATABASES setting as follows:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': os.environ.get('MYSQL_DATABASE'),
'PASSWORD': os.environ.get('MYSQL_ROOT_PASSWORD'),
'PORT': os.environ.get('MYSQL_PORT'),
'HOST': os.environ.get('MYSQL_HOST'),
}
}
So basically I removed USER key and updated PASSWORD with MYSQL_ROOT_PASSWORD, not MYSQL_PASSWORD tied to MYSQL_USER that I initiated my container with.
my .env file has a change like this:
MYSQL_ROOT_PASSWORD=myrootpassword
MYSQL_DATABASE=mydatabasename
MYSQL_PORT=3306
MYSQL_HOST=db
SECRET_KEY=random_secret_key_that_has_no_dollar_sign
my docker-compose.yml:
version: "3.9"
services:
db:
image: mysql:8
env_file:
- .env
command:
- --default-authentication-plugin=mysql_native_password
restart: always
ports:
- "3308:3306"
# volumes:
# - data:/var/lib/mysql
web:
build: .
command: >
sh -c "python manage.py wait_for_db &&
python manage.py makemigrations &&
python manage.py migrate &&
python manage.py runserver 0.0.0.0:8000"
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
env_file:
- .env
# volumes:
# data:
Interestingly as for ports part, notice that I set 3308:3306. Since I already have another running mysql container that is running with default port 3306, When I use ports 3306:3306, it didn't work. So I only changed outer port into 3308 and inner port 3306. Since django app communicates with inner port, .env file's port number stays put as 3306.
I think this is issue is not related django app, this is look like basic mysql error where you try to create/access database with that user which is not have permission for create/manage database, please test it again via root user of database.
You can visit on this url ERROR 1044 (42000): Access denied for user ''#'localhost' to database 'db' for.

Django docker container failed to connect to mysql container with error "Can't connect to MySQL server on 'db' (111)")

I am trying set up a Django development environment using docker. Though I can connect to the mysql on host machine. But the web container failed to connect to mysql container with following error:
django.db.utils.OperationalError: (2003, "Can't connect to MySQL server on 'db' (111)")
Below are the docker configurations and django configuration:
---------docker-compose.yml---------
version: '2'
services:
web:
build: .
volumes:
- ".:/code/current"
ports:
- "8000:8000"
depends_on:
- db
- redis
links:
- db
- redis
command: ./manage.py runserver 0.0.0.0:8000
db:
image: mysql:5.7
volumes:
- "./.data/db:/var/lib/mysql"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=goat_db
restart: always
ports:
- "3306:3306"
redis:
restart: always
image: redis:latest
ports:
- "6379:6379"
--------------Dockerfile for web image----------------------
FROM ubuntu:14.04
MAINTAINER Alice
RUN apt-get update
RUN apt-get install -y tar git curl wget emacs build-essential python python-dev python-distribute python-pip libpcre3 libpcre3-dev libmysqlclient-dev python-m2crypto openssl libssl-dev swig freetds-dev python-pymssql nginx subversion
RUN mkdir -p var/www/goat.garenanow.com/current/log
WORKDIR /var/www/goat.garenanow.com/current
ADD requirements.txt /var/www/goat.garenanow.com/current
RUN pip install -r requirements.txt
ADD . /var/www/goat.garenanow.com/current
EXPOSE 8000
------django database configuration---
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'goat_db',
'USER': 'root',
'PASSWORD': 'root',
'HOST': 'db',
'PORT': '3306',
},
If Django tries to connect to your database and MySql is not ready, then you will probably see this error:
django.db.utils.OperationalError: (2003, "Can't connect to MySQL server on 'db' (111)")
The solution for this case is wait for the db server to be ready before run the web server.
How we can do that?
Instead of running the web server directly we create and run a script that it will wait for the db server to be ready. After that the script will run the web server.
docker-compose.yml file (The relevant part is when we overwrite the web:command directive and we run the script instead of run the web server immediately).
version: '3'
services:
db:
restart: always
image: mysql:5.7
container_name: my_db
env_file: env_db
ports:
- "3306:3306"
web:
restart: always
build: ./web
env_file: env_web
command: ./wait_for_db_and_start_server.sh
ports:
- "8000:8000"
depends_on:
- db
Now env_web file (The relevant part is START_CMD variable).
# Add Environment Variables
DB_NAME=docker
DB_USER=docker_user
DB_PASS=docker_password
DB_SERVICE=db
DB_HOST=db
DB_PORT=3306
START_CMD=python manage.py runserver 0.0.0.0:8000
Now, our web Dockerfile (The relevant part is when we add wait_for_db_and_start_server.sh).
FROM python:2.7
ADD wait_for_db_and_start_server.sh .
ADD requirements.txt .
RUN pip install -r requirements.txt
ADD . .
Now wait_for_db_and_start_server.sh file. (Basically, while we cannot connect to our db server on the specified $DB_HOST:$DB_PORT defined in our env_web file, we wait 3 seconds and try again for M_LOOPS times. If we are able to connect to the server, then we run $START_CMD that was defined in our env_web file.)
#!/bin/sh
# Wait for database to get available
M_LOOPS="10"
#wait for mysql
i=0
# http://stackoverflow.com/a/19956266/4848859
while ! curl $DB_HOST:$DB_PORT >/dev/null 2>&1 < /dev/null; do
i=`expr $i + 1`
if [ $i -ge $M_LOOPS ]; then
echo "$(date) - ${DB_HOST}:${DB_PORT} still not reachable, giving up"
exit 1
fi
echo "$(date) - waiting for ${DB_HOST}:${DB_PORT}..."
sleep 3
done
echo "$(date) - ${DB_HOST}:${DB_PORT} Reachable ! - Starting Daemon"
#start the daemon
exec $START_CMD
What's your my.cnf file look like for the db service?
Check the bind-address value and also make sure the grant permissions are correct connecting from the web container.
To test, you could docker exec ... into the web container and try to connect to db host from there.
If you are trying to keep your web container "thin", you may not want to add mysql or postgres client packages, just to check if your db is ready. Some of the popular wait scripts out there have client dependencies.
I just created a simple Python script which makes native calls to see if the DB is functional. In this case I avoid adding valid credentials and just look for an authentication failure message. The example here is for Postgres, but should be easily adapted for MySQL.
wait_for_db.py
import psycopg2.extras
from time import sleep
connect_str = "dbname='postgres' user='nobody' host='db' " + \
"password='foobar'"
while True:
try:
conn = psycopg2.connect(connect_str)
except psycopg2.OperationalError as e:
if "authentication failed" in e.args[0]:
print("Postgres is ready. Launching site.")
break
else:
print("Waiting for postgres...", e.args[0])
sleep(1)
Then set your web container in your dev environment docker-compose.yml so that you have something like
command: bash -c "python wait-for-postgres.py; python manage.py runserver 0.0.0.0:8000"

Linking django and mysql containers using docker-compose

I've been following with the docker-compose tutorial here (linking django and postgres container). Although I was able to go through with the tutorial I'm however not able to proceed with repeating the same
using a mysql container.
The following are my dockerfile and docker-compose.yml
`
db:
image: mysql
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
links:
- db:db
`
dockerfile
FROM python:2.7
RUN mkdir /code
WORKDIR /code
RUN pip install mysql-python
RUN pip install django
They both build fine when I do docker-compose up but it seems the db environment variables are not passed to the django container since when I run os.environ.keys() in one of my django views I can't see any of the expected DB_* environment variables.
So does mysql require a different setup or am I missing something.
Thank you.
[EDIT]
Docker compose version
docker-compose version: 1.3.0
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
Docker version
Docker version 1.6.2, build 7c8fca2
In Django settings.py file make sure you have something like:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'django1',
'USER': 'django',
'PASSWORD': 'password',
'HOST': 'db',
'PORT': 3306,
}
}
then in your docker-compose.yml file make sure you have something along the lines of:
db:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: docker
MYSQL_DATABASE: docker
MYSQL_USER: docker
MYSQL_PASSWORD: docker
then as per the docker/django tutorial you are following run the following again to rebuild everything and things should start working
docker-compose run web django-admin.py startproject composeexample .
In response to a further question, the mysql root password variable is required by docker when creating new databases.
EDIT: added run to docker-compose above; see edit comment
you don't need to worry about environment variable. When linking containers together you just use the container alias defined by the link as if it was the hostname.
for instance if your docker-compose.yml file were:
db:
image: postgres
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
links:
- db:mydb
In your django settings you would have to set the database host to mydb.
First you need to modify the settings file...
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'postgres',
'USER': 'postgres',
'HOST': 'db',
'PORT': 5432,
} }
Then if you used the docker-compose command properly, the containers should be linked, and it should resolve the hostname db properly based on the links in the docker-compose.yml file.
Still, if you want to check the environment...
~/django-example: docker-compose run web env
Starting djangoexample_db_1...
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=66ff09ed8632
TERM=xterm
DJANGOEXAMPLE_DB_1_PORT=tcp://172.17.0.35:5432
DJANGOEXAMPLE_DB_1_PORT_5432_TCP=tcp://172.17.0.35:5432
DJANGOEXAMPLE_DB_1_PORT_5432_TCP_ADDR=172.17.0.35
DJANGOEXAMPLE_DB_1_PORT_5432_TCP_PORT=5432
DJANGOEXAMPLE_DB_1_PORT_5432_TCP_PROTO=tcp
DJANGOEXAMPLE_DB_1_NAME=/djangoexample_web_run_2/djangoexample_db_1
DJANGOEXAMPLE_DB_1_ENV_affinity:container==52c78c810792b0e7b9a231eab7ab7a3d50c95b76faf0abb8ec38a7d1ff0c7e5f
DJANGOEXAMPLE_DB_1_ENV_LANG=en_US.utf8
DJANGOEXAMPLE_DB_1_ENV_PG_MAJOR=9.4
DJANGOEXAMPLE_DB_1_ENV_PG_VERSION=9.4.4-1.pgdg70+1
DJANGOEXAMPLE_DB_1_ENV_PGDATA=/var/lib/postgresql/data
DB_PORT=tcp://172.17.0.35:5432
DB_PORT_5432_TCP=tcp://172.17.0.35:5432
DB_PORT_5432_TCP_ADDR=172.17.0.35
DB_PORT_5432_TCP_PORT=5432
DB_PORT_5432_TCP_PROTO=tcp
DB_NAME=/djangoexample_web_run_2/db
DB_ENV_affinity:container==52c78c810792b0e7b9a231eab7ab7a3d50c95b76faf0abb8ec38a7d1ff0c7e5f
DB_ENV_LANG=en_US.utf8
DB_ENV_PG_MAJOR=9.4
DB_ENV_PG_VERSION=9.4.4-1.pgdg70+1
DB_ENV_PGDATA=/var/lib/postgresql/data
DB_1_PORT=tcp://172.17.0.35:5432
DB_1_PORT_5432_TCP=tcp://172.17.0.35:5432
DB_1_PORT_5432_TCP_ADDR=172.17.0.35
DB_1_PORT_5432_TCP_PORT=5432
DB_1_PORT_5432_TCP_PROTO=tcp
DB_1_NAME=/djangoexample_web_run_2/db_1
DB_1_ENV_affinity:container==52c78c810792b0e7b9a231eab7ab7a3d50c95b76faf0abb8ec38a7d1ff0c7e5f
DB_1_ENV_LANG=en_US.utf8
DB_1_ENV_PG_MAJOR=9.4
DB_1_ENV_PG_VERSION=9.4.4-1.pgdg70+1
DB_1_ENV_PGDATA=/var/lib/postgresql/data
LANG=C.UTF-8
PYTHON_VERSION=2.7.10
PYTHON_PIP_VERSION=7.0.3
PYTHONUNBUFFERED=1
HOME=/root