I'm writing as docker-compose
file to up MySQL instance and want to use few variable from env file: here are the files actually look like:
docker-compose.yml
version: '3.3'
services:
db:
image: mysql
restart: always
env_file:
- ./imran.env
environment:
MYSQL_ROOT_PASSWORD: ${PASS}
ports:
- ${PORT1}: ${PORT2}
imran.env
PASS=imran123
PORT1=3306
PORT2=3306
Instead of working correct i'm getting following errors:
WARNING: The PASS variable is not set. Defaulting to a blank string.
WARNING: The PORT2 variable is not set. Defaulting to a blank string.
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.db.ports contains unsupported option: '${PORT1}
Please Help