Restrict jenkins only on localhost with docker and nginx
Remove the ports entry from jenkins. The ports entry is only needed to expose the port of the docker container to the localhost.
To expose the port to another docker container, linking them is sufficient. In your nginx links: you have already mentioned jenkins. Hence you don't need to have the ports entry in your jenkins.
...jenkins: ...nginx: links: - jenkins ports: - "80:80" ...