I have the following docker-compose
setup:
db:
image: postgres:10.5-alpine
adminer:
image: adminer:4.6.3
ports:
- 8080:8086
my-service:
image: my-image:latest
ports:
- 8080:8080
When I run docker-compose up
, I get the following error:
ERROR: for adminer Cannot start service adminer: driver failed programming
external connectivity on endpoint docker_adminer_1
(dcd0d56d58bbbefdea89dc64532854597fcaec9736d7ddb3f8de74bc1577d5ee):
Bind for 0.0.0.0:8080 failed: port is already allocated
I must be misunderstanding docker networking. I thought because, I'm mapping the 8080
port on the two services to different host ports viz. 8080
and 8086
, I thought I shouldn't have conflicts. I can't seem to be able to locate the relevant documentation on the web.
Can you guys please help me remedy this situation?
Thanks!
You have it backwards.
<host_port>:<service_port>
and not the other way around. Switch the numbers and you ought to be fine, but make sure your services are expecting traffic on those new ports.
Edit: documentation