Docker container doesn't expose ports when --net=host is mentioned in the docker run command

后端 未结 2 1257
野性不改
野性不改 2020-12-09 15:27

I have a CentOS docker container on a CentOS docker host. When I use this command to run the docker image docker run -d --net=host -p 8777:8777 ceilometer:1.x t

2条回答
  •  失恋的感觉
    2020-12-09 15:57

    I was confused by this answer. Apparently my docker image should be reachable on port 8080. But it wasn't. Then I read

    https://docs.docker.com/network/host/

    To quote

    The host networking driver only works on Linux hosts, and is not supported on Docker for Mac, Docker for Windows, or Docker EE for Windows Server.

    That's rather annoying as I'm on a Mac. The docker command should report an error rather than let me think it was meant to work.

    Discussion on why it does not report an error

    https://github.com/docker/for-mac/issues/2716

    Not sure I'm convinced.

提交回复
热议问题