I’m trying to do this:
# docker run --rm -itp 4000:80 nginx
# curl localhost:4000
<outputs welcome page>
But with Docker Compose it hangs.
docker-compose.yml
:
version: '3'
services:
nginx:
image: nginx:stable
ports:
- "4001:80"
# docker stack deploy -c docker-compose.yml s1
# curl localhost:4001
<hangs>
But it does work this way:
$ curl 172.17.0.1:4001 # docker0
or
$ curl 172.18.0.1:4001 # docker_gwbridge
Is that expected behavior? Is there a way to make it accessible via localhost?
I’m running Arch Linux.