Develop Applications using Bitnami Development Containers
Introduction
Developers are increasingly adopting a so called "micro services" architecture and using Linux containers for development. At Bitnami, we have developed tools and assets that dramatically lower the overhead for developing with this approach.
If you've ever tried to start a project with containers before, you probably found the advice, tools, and documentation to be chaotic, out of date, or wrong. Bitnami Development Containers fix these problems by providing you with a ready-to-go environment for the development framework of your choice backed by Bitnami.
Why Docker?
Developers are adopting containers for development because they offer many of the same advantages as developing in VMs, but with lower overhead in terms of developer effort and development machine resources.
Development environments based on Docker are highly reproducible because the definition of each container and how to build it is captured in a Dockerfile. With Docker, you can create a development environment for your code, and teammates can pull the whole development environment, install it, and quickly get started writing code or fixing bugs.
The Bitnami Approach
When we designed and built Bitnami Development Containers, we kept the following guiding principles in mind:
Infrastructure should be effort free. By this, we mean, there are certain services in an application that are merely configured. For example, databases and web servers are essential parts of an application, but developers should depend on them like plumbing. They should be there ready to use, but developers should not be forced to waste time and effort creating the plumbing. You should choose your development framework, and everything else should come ready to work "out of the box."
Production deployment is a late bound decision. Containers are great for development. Sometimes they are great for production, sometimes they are not. If you choose to get started with Bitnami Development Containers, it is an easy matter to decide later between monolithic and services architectures, between VMs and containers, between cloud and bare metal deployment. This is because Bitnami builds containers specifically with flexibility of production deployment in mind. We ensure that a service running in an immutable and well-tested container will behave precisely the same as the same service running in a VM or on bare metal.
Before you begin
Before you can start using the Bitnami Development Containers you need to have the following components properly setup on your development host:
Please refer to the Docker documentation for instructions on installing and using these tools.
Step 1: Download a Bitnami Orchestration File
The Bitnami Development Containers are currently orchestrated with their associated infrastructure containers using docker-compose. So, to get started, simply download the docker-compose.yml file for your framework of choice.
mkdir ~/workdir/myapp
cd ~/workdir/myapp
Next, download our Docker Compose orchestration file:
curl -L URL_TO_DOCKER_COMPOSE_FILE > docker-compose.yml
Replace the URL_TO_DOCKER_COMPOSE_FILE placeholder with the URL to the correct docker-compose.yml file to set up the development framework of choice:
Step 2: Run
After downloading the file, it is a simple command to start the development environment.
docker-compose up
This command reads the contents of the orchestration file and begins downloading the Docker images required to launch each of the services listed therein. Depending on the network speeds this can take anywhere from a few seconds to a couple of minutes.
After the images have been downloaded, each of the services listed in the orchestration file is started. Infrastructure containers such as databases come pre-configured with credentials, ports, and everything else necessary to work with the development framework.
The containers are designed to behave as if they are immutable. That means that they mount their directories on your development machine, and read and write all files there. Since the application source resides on the host, you can use your favourite IDE for developing the application. Only the execution of the application occurs inside the isolated container environment. This also makes it simple to use source control on your project, and so long as you don't modify the containers, your project will be easily reproducible.
Step 3: Execute commands
Some frameworks require the developer to issue commands in order to do things like generate code. The ability to issue commands to programs that reside inside the container is built into Docker Compose:
docker-compose exec SERVICE COMMAND
Replace the COMMAND placeholder with the command you wish to execute inside the service container identified by the SERVICE placeholder. For example, the following command instructs Docker Compose to execute the bundle install command inside the myapp service container:
docker-compose exec myapp bundle install
The return value of the docker-compose command will reflect that of the specified command.
Next Steps
Start using the Bitnami Development Containers for your projects. We currently support the following development frameworks: