Saludos colegas, Estoy intentando configurar un archivo docker-compose.yml
, con los siguientes comandos:
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
Adicional al archivo tengo otro archivo .env
el cual contiene todas las variables de entorno, es el siguiente:
#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
Cuando intento correr docker-compose up web postgres
obtengo la siguiente advertencia:
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.
Intenté seguir la documentación de docker
Docker enviroment variables pero no logro que funcione correctamente, además también intenté hacerlo por args
, porque docker
advierte sobre el proceso de build
Note: If your service specifies a build option, variables defined in environment files will not be automatically visible during the build. Use the args sub-option of build to define build-time environment variables.
Pero tampoco consigo realizar la configuración de variables de entorno, si alguien se ha enfrentado a este problema apreciaría bastante su ayuda, muchas gracias colegas.
"$variable"
. Adicional a ello también debes configurar tu archivo con el nombre.env
de otra forma no me pudo funcionar,Saludos.