Docker set ipaddress and start services

I have setup docker and create container but problem is i want to bring up on my LAN IP subnet, I have configured docker0 has bridged and start docker -d -b docker0, Now i want to start container with static IP and start httpd and mysqld services.


  • Docker install causes host machine to be unreachable
  • Import qcow2 image to docker hub
  • Java version updated on package installation
  • How to delete the HDFS data in Docker containers
  • How can i spawn a multiple instances of a container using kubernetes?
  • Set EnableSendfile Off from Dockerfile
  • FROM centos/centos6-latest
    RUN /sbin/ifconfig eth0
    RUN /sbin/route add default gw
    RUN /etc/init.d/mysqld start
    RUN /etc/init.d/httpd start


    [root@server ~]# docker build -t centos/centos6-latest .
    Sending build context to Docker daemon 146.8 MB
    Sending build context to Docker daemon
    Step 0 : FROM centos/centos6-latest
     ---> 123729f9961b
    Step 1 : RUN /sbin/ifconfig eth0
     ---> Running in c722910e1997
    SIOCSIFADDR: Permission denied
    SIOCSIFFLAGS: Permission denied
    SIOCSIFNETMASK: Permission denied
    SIOCSIFBROADCAST: Permission denied
    2014/12/23 07:03:38 The command [/bin/sh -c /sbin/ifconfig eth0] returned a non-zero code: 255

    I know you have to start container with --privileged mode but i don’t know how do i set it with build option

  • Host volumes / environment variables not available during container build stage
  • Ember + Docker slow during transpilation
  • installing ssh in the docker containers
  • How to build, test and deploy using Jhipster, Docker, Gitlab and Heroku
  • error: couldn't read version from server: Get http://localhost:8080/api: dial tcp connection refused
  • Change Docker machine location - Windows
  • One Solution collect form web for “Docker set ipaddress and start services”

    Docker containers are not full virtual machines.

    Network configuration is done at boot, not build. You cannot assign a static ip without an external tool like pipework. I would suggest reading the networking docs. A static IP is not ‘the docker way’.

    Also, containers do not typically use a full blown init system. If you must start multiple services, supervisord or runit are common alternatives.

    The privileged flag is specified at docker run, not during the build process.

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