Why can't list the port?

The container was created this way:

sudo docker run -d   --name homeassistant                              \
                     --privileged                                      \
                     --restart=unless-stopped                          \
                     -p 8123:8123                \
                     -v homeassistant_config:/config                   \
                     --network=host   ghcr.io/home-assistant/home-assistant:stable

I start it

sudo docker start   homeassistant 

Now the app is listening on the port 8123.
Why can’t list the port with:

sudo docker ps -a
CONTAINER ID   IMAGE                                          COMMAND            CREATED        STATUS          PORTS     NAMES
a94d82d0cd6f   ghcr.io/home-assistant/home-assistant:stable   "/init"            26 hours ago   Up 52 minutes             homeassistant
debian@debian:~$ sudo docker port a94d82d0cd6f
nothing output

Why no 8123 as output?


Its because you’re using network=host, the ports in docker ps, is only the mapped ports, which isnt used in network=host

So, instead you can check your hosts ports: netstat -tulpn | grep 8123, to see if its listning.