Docker Community Forums

Share and learn in the Docker community.

Docker-compose will only open *some* ports

I’m using Ubuntu and the commands
docker-compose build --pull
docker-compose up --detach

I have multiple containers with different ports listings.
I am viewing the port setup with both docker ps and the Ubuntu iptables command (they both agree)

The following works
- 30303:30303
- 8544:8545/tcp

The following does not work (i.e. does not setup the link in docker ps nor add 30304 to the iptables)
- 30304:30303
(I also have 6 other containers attempting to map external 30305 to 30309 to the containers’ 30303 with equal lack of success)

I am at a total loss here. I’m assuming that it is a docker/docker-compose issue since docker ps doesn’t show the mapping – but I don’t see any distinguishing features between what is working and what is not.

I’d recommend using port ranges i.e


  • “1-65535:1-65535”

You will probably need to tinker with this range according to your app specifications so that you won’t accidentally expose something that’s already in use by the host (such as SSH).