title: Driver failed programming external connectivity: ... bind: cannot assign requested address
body: <p>In my development environment I want to simulate a "web farm" deployment, where I have several "physical" nodes running multiple services, which belong to the same network. </p>
  
  <p>So, say I have 5 nodes, each node will host 1 <code>mysql</code>, 1 <code>nginx</code> and 2 <code>web</code> apps. And <code>mysql</code> will bind to the same port <code>3306</code>, but on different ip addresses. </p>
  
  <p>I started to write down <code>docker-compose</code> config and stuck on a very first step: Docker refuses to create new ip in a given network and bind mysql to a port on that ip.</p>
  
  <p>That's the configuration I'm trying to use: </p>
  
  <pre><code>version: "3"
  
  services:
      node1_sql:
          image: mariadb:10.0.33
          restart: always
          networks:
            skkb:
              ipv4_address: 10.9.2.2
          ports: 
           - 10.9.2.2:3306:3306
          environment:
           - MYSQL_DATABASE=dbname
           - MYSQL_ROOT_PASSWORD=password
          volumes:
           - ./sql_data/1:/var/lib/mysql
          command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci
  
  networks:
      skkb:
          driver: bridge
          ipam:
              driver: default
              config:
                  - subnet: 10.9.2.0/24
  </code></pre>
  
  <p>When I try to do <code>docker-compose up</code> I get following error:</p>
  
  <pre><code>Creating network "node-r_skkb" with driver "bridge"
  Creating node-r_node1_sql_1 ... error
  
  ERROR: for node-r_node1_sql_1  Cannot start service node1_sql: driver failed programming external connectivity on endpoint node-r_node1_sql_1 (24a8412b80ebc95f5b15f5d4ea5281639d6914f312f525cf8803ed5179b906a7): Error starting userland proxy: listen tcp 10.9.2.2:3306: bind: cannot assign requested address
  
  ERROR: for node1_sql  Cannot start service node1_sql: driver failed programming external connectivity on endpoint node-r_node1_sql_1 (24a8412b80ebc95f5b15f5d4ea5281639d6914f312f525cf8803ed5179b906a7): Error starting userland proxy: listen tcp 10.9.2.2:3306: bind: cannot assign requested address
  ERROR: Encountered errors while bringing up the project.
  </code></pre>
  
  <p>If I try to bind to <code>10.9.2.1</code>, it works no problem. So it seems to me that it cannot create new IP address which is configured as <code>ipv4_address: 10.9.2.2</code></p>
  
  <p>Any ideas how to fix that?</p>