Docker (stopped) container has no IP address

The reason is simple based on the output of docker ps -a result that you posted in the top.

You might have noticed that it is showing status Exited (1) 5 minutes ago for the container whose id is ca030d3cf1c2. That means, container is stopped.

Once container is stopped, it will not have any IPAddress. That's the reason being shown empty in the result of docker inspect ca03 which you posted.

Start the container, you would get the IPAddress.

To your last question, you may have that configuration for port forwarding using your docker-compose.yml file. Or you may also do it while running docker run using -p <hostport>:<container port> option.

Hope this is helpful.