Greetings colleagues, I am trying to configure a file docker-compose.yml
, with the following commands:
nginx:
restart: always
build: ./nginx/
ports:
- "80:80"
volumes:
- /www/static
volumes_from:
- web
links:
- web:web
version: '2'
services:
postgres:
env_file: .env_development
restart: always
build: ./postgres
ports:
- "5432:5432"
expose:
- "5432"
tty: true
volumes:
- /var/lib/postgresql/data/
networks:
app_net:
ipv4_address: ${POSTGRES_IP}
web:
env_file: .env_development
restart: always
build: ./web
tty: true
ports:
- "8000:8000"
links:
- postgres:postgres
volumes:
- /home/kalismash/Docker/app_django/web/app:/home/julian_develop/apps
networks:
app_net:
ipv4_address: ${DJANGO_IP}
command: python manage.py runserver 0.0.0.0:8000
networks:
app_net:
driver: bridge
ipam:
config:
- subnet: 172.25.0.0/24
In addition to the file I have another file .env
which contains all the environment variables, it is as follows:
#Set of enviroments global
LANG=es_CO.utf8
SHELL=/bin/bash
SHELL2=/bin/sh
TERM=xterm
#Postgress environment
PG_SERVICE=postgres
PGDATA=/var/lib/postgresql/data
POSTGRES_USER=develop_julian
POSTGRES_PASSWORD=postgress
POSTGRES_DB=django
ENVIROMENT=Development
ENVPORT=5432
POSTGRES_IP=172.25.0.9
#Django environment
USER=django_develop
SECRET_KEY=6g_,p?@$/t+Kgfy8c=BC*zQPNM*eJ,qZ&*@iL>9Q
DJANGO_IP=172.25.0.8
When I try to run docker-compose up web postgres
I get the following warning:
WARNING: The POSTGRES_USER variable is not set. Defaulting to a blank string WARNING: The IP_POSTGRES variable is not set. Defaulting to a blank string.
I tried to follow the documentation of docker
Docker enviroment variables but I can not get it to work properly, plus I tried to do it for args
, because docker
warns about the process of build
Note: If your service specifies a build option, variables defined in environment files will not be visible visible during the build. Use the args sub-option of build to define build-time environment variables
But I also can not configure environment variables, if someone has faced this problem I would appreciate your help, thank you very much colleagues.