You have some issues in your docker-compose.yaml file:
A:
A space symbol between ports values. It should be without a space:
ports:
- ${PORT1}:${PORT2}
B:
You need to use .env file in folder where docker-compose.yaml is in order to declaring default environment variables for both docker-compose.yaml file and docker container. env_file section is used to put values into container only.
So, you should do the following:
1.
Re-name file with ENV variables to .env:
mv imran.env .env
2.
Use the following docker-compose.yaml after:
version: '3.3'
services:
db:
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: ${PASS}
ports:
- ${PORT1}:${PORT2}