Regarding docker daemon to spawn containers in a custom CIDR block

I have a use case in which i want to spawn docker containers in a different CIDR block. At this point I have created my own custom image. Now I created a new bridge as follows:-

service docker stop
ip link add br0 type bridge
ip addr add MYCIDRBLOCK dev br0
ip link set br0 up
docker -d -b br0

So far so good, the daemon gave the following output:-

  • Docker : RUN cd … does not work as expected [duplicate]
  • Docker WordPress CPU jumps when selecting featured image
  • How to open jupyter nookbooks in docker container?
  • Cannot get more than one port to be exposed with docker [duplicate]
  • Get hostname in Logstash running in a Docker container
  • How to run uWSGI and NGINX in different Docker containers
  • INFO[0000] Listening for HTTP on unix (/var/run/docker.sock) 
    INFO[0000] [graphdriver] using prior storage driver "devicemapper" 
    WARN[0000] Running modprobe bridge nf_nat failed with message: , error: exit     status 1 
    INFO[0000] Loading containers: start.                   
    ........................
    INFO[0000] Loading containers: done.                    
    INFO[0000] Daemon has completed initialization          
    INFO[0000] Docker daemon                                 commit=0baf609     execdriver=native-0.2 graphdriver=devicemapper version=1.7.0
    

    Now i try to start my docker container with all ports exposed:-

    docker run -d -i -t -expose 1-59999 arunav/myimage /bin/bash
    

    On client side I get:-

     Error response from daemon: Cannot start container 1d29cf0d8057fd62bae9e45e5a91968b675a6c43e115f7912dd00abb05d90dd9: invalid argument
    

    On server side i get the following info:-

    ERRO[0042] leaving endpoint failed: a container has already joined the endpoint 
    ERRO[0042] Handler for POST /containers/{name:.*}/start returned error:   Cannot start container  1d29cf0d8057fd62bae9e45e5a91968b675a6c43e115f7912dd00abb05d90dd9: invalid argument 
    ERRO[0042] HTTP Error                                    err=Cannot start container 1d29cf0d8057fd62bae9e45e5a91968b675a6c43e115f7912dd00abb05d90dd9: invalid argument statusCode=500
    

    So at first I thought that some previous container is hogging some endpoint. So I ran this command to get rid of container dumps:-

     docker ps -a -q | xargs -n 1 -I {} docker rm {}
    

    I dont know then what could be the issue. Can someone help?

  • unable to run web application on docker
  • Trouble hitting a container's exposed port from a seperate container & host
  • Run a command on a container from inside another one
  • Docker Calico networking: Why container from ipip network cannot communication with container from other networks?
  • How to know server's IP address where jenkins deploys and builds code
  • MongoDB Script with rs.add() Not Executing As Expected
  • One Solution collect form web for “Regarding docker daemon to spawn containers in a custom CIDR block”

    Why do you need to add an extra bridge? Did you try to use default bridge with explicit CIDR in --bip arg?

    –bip=CIDR — supply a specific IP address and netmask for the docker0 bridge, using standard CIDR notation like 192.168.1.5/24.

    (from here)

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.