<p>I am trying to configure a few containers to use a static IP address added to the host.</p>

<p>I have the server configured with main IP <code>1.1.1.1</code> and added a virtual interface (eth0:0) with IP address <code>2.2.2.2</code> (<code>1.1.1.1</code> and <code>2.2.2.2</code> are just example IP addresses, to avoid leaving the real ones here).</p>

<p>I have been able to configure 2 containers to use that IP address, using hostports <code>2.2.2.2:8080</code> and <code>2.2.2.2:2222</code>.</p>

<p>I am now trying to add a third container, with hostport <code>2.2.2.2:80</code></p>

<p>When I try to do that, I receive the following error:</p>

<p><code>0/1 nodes are available: 1 node(s) didn't have free ports for the requested pod ports.</code></p>

<p>What configuration am I missing here? Rancher web interface is replying in <code>1.1.1.1</code> and <code>2.2.2.2</code>, but I would like it to only use <code>1.1.1.1</code>, leaving the other IP addresses and ports for containers.</p>

<p>These are the commands I used to fire up rancher, and I am not sure if I should change the <code>80</code> or <code>443</code> part (on the left or the right) to match the correct public IP I want to map to rancher:</p>

<pre><code>docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher
sudo docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run rancher/rancher-agent:v2.1.7 --server https://[MY_HOST] --token [token] --ca-checksum [ca-chaecksum] --etcd --controlplane --worker
</code></pre>

Miguel Mesquita Alfaiate
<p>Based on the info, I am deducing that you are using the same host to run Rancher and also register in a cluster.</p>

<p>When you specify <code>-p 80:80</code>, it means <code>0.0.0.0:80:80</code>, so all the IP addresses are used up. Hence when you try to run a container later to expose port 80, it will fail.</p>

<p>To be able to not listen on all IP addresses, you need to specify the IP address to listen on when running the Rancher server container.</p>

<p>Example: <code>docker run -d --restart=unless-stopped -p 1.1.1.1:80:80 -p 1.1.1.1:443:443 rancher/rancher</code></p>
