consider a docker .yml file like this:
version: '3.8'
services:
postgres:
image: postgres:13
restart: always
environment:
- POSTGRES_USER=prisma_pg
- POSTGRES_PASSWORD=benchmark
volumes:
- postgres:/var/lib/postgresql/data
ports:
- '5454:5432'
volumes:
postgres:
after I ran these commands:
docker-compose -f ./docker-compose.yml up -d
docker-compose ps
its State is UP and the ports
column showing
0.0.0.0:5432->5432/tcp
illustrates that the running port is not set to 5454->5432
as we described in the yaml file,
How can we fix it to map the port correctly?
Edit:
the file is saved in the same directory and there is no other container running before or after this one:
2
Answers
I copied the docker file out of project space and it WORKED! same system, same commands! still not working in the project directory :D wondering how it's possible
Try running with Compose V2 by omitting the hyphen:
Do you get the same result?