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 on Windows 10 startup: database tables and bound directories are disappearing
  • Pass environment variables to Dockerfile during build time
  • Running Ruby Sinatra inside a Docker container not able to connect (via Mac host) or find commands (in different scenario)?
  • How to import my db dump into mariadb on start?
  • Install Firefox on Tinycore (Docker)
  • Install shipyard on existing docker swarm
  • 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

  • AWS EC2 ELB Docker Routing
  • Docker does not free disk usage on Windows 10
  • How does docker-compose start container on login (ubuntu/systemd)
  • Drone local and
  • How to change the default location for “docker create volume” command?
  • How can I run specific android app automatically by using Docker?
  • 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.