No Port Mapping in Container

Hi,

I have spinned up a container through Rancher. I entered port information.

However, when I run ‘docker ps -l’ , it does not show any port mapping.

Eventually, I wanted to bring up a web server.

Please advise.

Thanks in advance
Radhika

Rancher monitors port mapping using iptables and not through docker.

http://docs.rancher.com/rancher/rancher-ui/applications/stacks/adding-services/#port-mapping

That may be the case but if you want this information, how to get it? Note, I’m discussing externally exposed ports.

  • sudo docker inspect --format '{{ .NetworkSettings.Ports}}' container_id
  • sudo iptables --list DOCKER [--verbose] [--numeric]

Any other suggestions?

@sjiveson

If you log into the host, you can do a sudo iptables-save which will list the exposed port on the host.

Are you looking for the specific port that is exposed in the container and which port it’s mapped to? In the UI, this can be shown in the detailed page of hte container in the ports tab.

Just FYI Denise, on a Rancher OS host, that command isn’t available but this is:

sudo iptables -S
sudo iptables --list-rules

I’ve also corrected and clarified my first comment.

Cheers