skip to Main Content

docker-compose.yaml

version: "3"

services:

  Database:

    image: postgres
    container_name: Database
    restart: always
    ports:
      - "${DATA_BASE_PORT}:${DATA_BASE_PORT}"

    env_file:
      - 01-Source/Infrastructure/Interactions/ClientAndFrontServer/.env.dataBase.local.public
      - 01-Source/Infrastructure/Interactions/ClientAndFrontServer/.env.dataBase.local.private

    // ...

I made sure that paths to files are correct. If to make mistake in these path, the error like

open D:IntelliJ IDEAXXX1-SourceInfrastructureInteractionsClientAndFrontServe
r.env.dataBase.local.publicd: 
The system cannot find the file specified.
`docker-compose` process finished with exit code 14

will occur.

.env.dataBase.local.public

DATA_BASE_HOST=localhost
DATA_BASE_PORT=5432

The error

Ttime="2022-10-23T10:51:41+09:00" level=warning msg="The "v" variable is not set. Defaulting to a blank st
ring."
1 error(s) decoding:

* error decoding 'Ports': No port specified: :<empty>
`docker-compose` process finished with exit code 15

2

Answers


  1. Chosen as BEST ANSWER

    Solution for IntelliJ IDEA IDEs family

    In the Docker setup at Run/Debug Configurations, specify the Environment variables file via Modify options:

    enter image description here

    What a pity that GUI available only in local development mode xD


  2. The env_file directive sets up environment variables inside the container and doesn’t affect docker compose.

    To set environment variables you can use in docker compose, you can either name the file .env or you can use the --env-file option on your docker compose commands

    To use your database file, you’d do

    docker-compose --env-file .env.dataBase.local.public up
    

    More info here: https://docs.docker.com/compose/environment-variables/#using-the—env-file–option

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search