Development environment setup for Mac and CentOS using Docker

I have searched the history a little bit but failed to find a good answer. So I just asked my question here. If there is a good answer already, please redirect it for me. Thanks.

The question is, I found my company’s new hire doc lists a bunch of software to install to setup the development environment. Usually it took 1 or 2 days for a new hire to setup everything ready for a new mac. We want to shorten that process. The first thing I thought is Docker.

  • Ubuntu 14.04 - wget is hanging
  • Docker node development environment on windows
  • How to link docker containers?
  • Connect to mysql inside docker
  • How to expose a docker machine to an internal network
  • how to set ulimit / file descriptor on docker container the image tag is phusion/baseimage-docker
  • I read through the user guide of Docker and followed some blogs regarding to how to setup dev environment using Docker but still a little confused if Docker applies to our setting. So here’s the detail of requirements:

    1. We need to install a bunch of software (many of them are customized binaries). Right now, we distribute the source code, a new hire need to build from the source code, install it and set environment to include the binary into path. I am wondering if Docker allows us to install customized binaries into it’s container?

    2. The source code should not stay in the container. The source code is still checked out in one’s local machine using git. Then, how can I rely on the Docker container’s environment to build my software? I have searched a little bit is that, you need to mount your folder into the container, and then shell into your container to build? Is that how it works?

    3. We usually develop in mac, does Docker also support mac container or it just allows you to run Linux container using boot2Docker?

    Thank you so much in advance for your help.

  • Container doesn't ping with OpenVSwitch and Ryu controller
  • Docker - run two processes in single container
  • Docker - Application source code updates
  • Is it possible to start a stopped container from another container
  • Hypervisor is not running?
  • Chaining Docker Images and execute in order
  • 2 Solutions collect form web for “Development environment setup for Mac and CentOS using Docker”

    Some answers 🙂

    First, I think it’s a really good idea to use Docker to standardise the development configuration (softwares, custom packages, env variables, …).

    1. With Docker, you can get your customised binaries from the host, it’s not a problem. With the CMD command, you can use bash to install them and add them into your PATH. You can also write a shell script to install all your stuff and launch this script when you build your container
    2. Your code will be on the host and you can “mount” a host folder in your docker image with the -v command. Ex: docker run -v /home/user/code:/tmp/code your_image. I’ll detail below how the developer will use your Docker image.
    3. Yep, you have to use Boot2Docker, it works well

    Once your development image will be ready, you have to publish it on the official Docker registry (or to host a local registry on your network).

    Next, the developer will launch the following Docker command:
    docker run -rm -ti your_build_image /bin/bash

    This will launch a bash terminal in your Docker image and the developer will be able to compile the code. Ex: cd /tmp/code + mvn clean install

    Please have a look to this article to learn about volumes:

    And this one about Dockerfile:

    You can also find a lot of Dockerfiles on github (search Dockerfile).

    If the goal is to speed up the time it takes to get a Mac setup and usable in your environment, you might want to look at Boxen.

    From the “About” section:
    “Boxen is your team’s IT robot. It’s a dangerously opinionated framework that automates every piece of your development environment. GitHub, Inc. wrote the first version of Boxen (imaginatively called “The Setup”) to help employees start shipping on day one.”

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