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.


  • What is the proper command to restart a Dokku app from SSH?
  • Set http_proxy for Docker parent image build
  • Docker - no such file or directory
  • How to access root-folder from dockerfile which isn't in root
  • Error getting IP address: Something went wrong running an SSH command! command
  • Loading PostgreSQL Database Backup Into Docker/Initial Docker Data
  • 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

  • Spring-agent: Error opening zip file or JAR manifest missing
  • Difference between container restart due to liveness problems or due to stop request
  • Couchbase XDCR in a Docker container
  • Docker : Persisting build argument in container during run?
  • Is it possible to run a command when stopping a Docker container?
  • Cronjobs in Docker container how get them running?
  • 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.