New HA Docker container is running but can't be accessed via IP?

Hi folks,

I reinstalled my Raspberry Pi OS and am trying to get Home Assistant running in a Docker container. The run command was accepted and the container’s logs are not showing any errors. It was set up using --network=host, so it should be able to access port 8123.

I have no firewall and nothing else is using that port.

But when I access <ip_address>:8123, nothing shows up. Instead, it says:

This site can’t be reached
<ip_address> refused to connect

When I check nmap, port 8123 is displayed as closed. I know it’s the correct IP address, as I’ve checked several times. Every time I stop, remove, and then recreate the container, the same thing happens.

I just installed this version of Raspberry Pi OS, Docker, Home Assistant, etc., today, so I have no reason to think it’s outdated software.

I’m very new at this, so any help you can give me is sincerely appreciated. If seeing my run command would help, let me know.

EDIT: I was able to get this working by running the container using sudo. I had already followed the instructions to allow me to create containers rootlessly, so why this happened I have no idea. For now, I am just going to live with the inconvenience.