Docker and CI/CD · Junior · Question 71 of 75
docker run -p 5432:5432 postgres fails with "port is already allocated". Why?
- ✓Correct answer: Something on the host already uses port 5432
- 2Postgres can't run on its default port in Docker
- 3The image was built for a different port
Explanation
Perhaps a local Postgres or another container. Map a different host port, like -p 5433:5432; the container side stays the same.