Use Kool to Dockerize Your Local Development Environment the Right Way
Tags: docker, opensource, devops, webdev
Published: 2021-07-01 20:04:20

Using Docker containers in local development environments has become commonplace for web development. And yet, when you get down to it, using Docker locally is still a challenge, oftentimes resulting in a frustrating developer experience and plenty of headaches. So, what is **the right way** to use containers for local development? We believe the answer is a new open source project called [**Kool**](https://github.com/kool-dev/kool).

> [**Kool**](https://github.com/kool-dev/kool) helps you develop cloud native applications in a better and more efficient way by removing barriers and allowing developers and DevOps engineers to focus on what matters most.

## The Real-World Learning Curve

In the past few years, Docker has taken the software development world by storm. Its powerful interface for building, deploying and running containers has led to its widespread adoption by teams and companies of all sizes. By containerizing your web applications, you can more easily work across different tech stacks, switch between different applications and microservices, and standardize and scale your environments. You no longer waste precious time debugging and fixing issues with version mismatches, concurrently running applications, dependency conflicts, poor resource control, etc.

However, while Docker has a straightforward "getting started" experience, developing real-world applications on containers is a lot easier said than done. You quickly start climbing a steep learning curve when your requirements evolve and you're forced to master Docker's nuances, its more advanced configurations, and the working internals of its containers in order to apply its features to more complex environments.

> For example, mastering when to use the `-t` or `-T` flags for `docker run` and `docker exec`, resolving issues with permissions on mapped volumes, and even deeper issues like having your Docker network suddenly lose external packages because it has a different MTU value than the underlying host network. If you've faced these issues before, I feel for you. If not, count yourself lucky!

While Docker provides teams with a lot of power, this power does not come cheap. As you climb the Docker learning curve, you often have no choice but to use trial and error to find acceptable solutions to problems you encounter along the way. Since Docker expertise can vary greatly across the team, it is common to find knowledge siloed with senior members of the team, and developers applying different solutions to the same problem. Additional hidden costs include senior engineers pulled away from their work to help others with technical issues, time spent reconciling conflicting opinions and workarounds, and the frustration of disrupted workflows causing low morale. Consequently, it becomes difficult for your project to sustain its high velocity, and stay on schedule and on budget.

## A Better Way with Kool

**Kool** ([kool-dev/kool](https://github.com/kool-dev/kool)) offers a better way to use Docker locally. Kool provides a suite of open source tools that deliver a better developer experience (DX) and help you avoid the pitfalls described earlier by making sure you follow best practices and use Docker in a standardized way across your projects and teams. From local development environments running on Docker to staging and production environments running in the cloud on Kubernetes, Kool makes it easier to containerize your web apps.

### Kool CLI

The `kool` CLI provides a simple, intuitive interface for managing Docker and Docker Compose containers. It simplifies the way you use Docker in your local environment by removing the Docker "speed bumps" that slow you down, greatly reducing the learning curve and error-prone area, and helping teams leverage containers at a lower cost of entry.

> Kool CLI comes with a [single-line installer](https://kool.dev/docs/getting-started/installation), a [`self-update` command](https://kool.dev/docs/commands/kool-self-update) to easily upgrade to new releases, an intuitive command interface with a complete [command reference](https://kool.dev/docs/commands/kool), and solid [documentation](https://kool.dev/docs/introduction). By using the `kool` CLI instead of `docker` directly, you can stop learning new flags each day and stay focused on writing code!

### Kool Presets

Kool Presets provide pre-built development environments with sane defaults out of the box for quickly setting up projects using popular frameworks and tech stacks, such as Laravel, Symfony, Node.js, AdonisJs, Next.js (and more). Presets auto-generate a customized `docker-compose.yml` file, as well as a `kool.yml` configuration file in which you can easily store common single-line and multi-line scripts that you execute using the `kool run` command. This helps keep your development workflow open and shared across the entire team. [Learn more about how it works](https://kool.dev/docs/getting-started/how-it-works).

### Kool Docker Images

When you start developing in containers, you suddenly realize official Docker images are built for deployment, and are not well-suited for the special nuances of local development. One of the most common and recurring problems we see are permission issues with mapped volumes, due to host users being different from container users. Kool fixes this problem, and many others, by creating custom Docker images optimized for local development environments.

- PHP Images (https://github.com/kool-dev/docker-php)
- Nginx Images (https://github.com/kool-dev/docker-nginx)
- Node Images (https://github.com/kool-dev/docker-node)
- Java Images (https://github.com/kool-dev/docker-java)
- DevOps Images (https://github.com/kool-dev/docker-toolkit)

A few of the optimizations included in Kool Docker images:

- UID mapping to host user to solve permission issues
- Alpine base images to remain small and up-to-date
- Configured with sane defaults (for development as well as production)
- Environment variables to easily update the most common settings
- Battle-tested - we've been using these images in production for quite a long time now!

> If you know what you're doing, you can use `kool` with any Docker image. You are not required to use Kool-optimized images.

### Kool Cloud (Coming Soon)

Kool CLI integrates seamlessly with Kool Cloud. Based on the same Docker configuration you already use locally, you can very easily and quickly create staging environments in the cloud, straight from your local environment. Using a set of `kool deploy` commands, you can push your local project repository to the Kool Cloud, where it's automatically deployed on containers running on a shared Kubernetes infrastructure. Your local environment and cloud environments have never been so close to each other!

> Kool Cloud is currently being tested in a closed alpha, but will soon be opened as a public beta. If you would like early access, [please create a free account](https://kool.dev/register).

### Flexible and Extensible

If you know your way around Docker, you can use Kool and remain totally in charge of your Docker configuration. Kool guarantees no vendor lock-in and no loss of control, which means you can fully customize and extend your more specialized Docker environments. You'll never feel as if your hands are tied. On the contrary, using Kool will actually free your hands, and let you focus on more valuable work instead of spending time tweaking your development environment.

### Open Source

Kool is [open source](https://github.com/kool-dev/kool) and totally free to use. Feel free to [contribute](https://github.com/kool-dev/kool/blob/master/CONTRIBUTING.md), help us with testing, and/or [suggest new ways](https://kool.dev/slack) to make Kool better.

> If you like what we're doing, show your support for this new open source project by [**starring us on GitHub**](https://github.com/kool-dev/kool)!

### Battle-Tested

Kool is sponsored and maintained by [Firework Web](https://fireworkweb.com), a software development agency located in Brazil. Over many years, having worked on hundreds of web projects with dozens of teams, Firework developed a ton of expertise using Docker and other development tools, and figured out the right way to set up and manage local Docker environments. Based on this experience, the Kool project was born. And now Firework is ready to share it with all of you.

## Give It a Try

Kool is a great new development tool that will help you use Docker containers in your local environment the right way. You'll get all the benefits of containerizing your web apps, without the hassles. If you haven't already, [give Kool a try](https://kool.dev/docs/getting-started/starting-new-project).

---

### Not Using Docker for Development?

If you're not yet using Docker in your development environment, here's a great post that gives you a number of reasons why you should make the switch.

{% link https://dev.to/danielgaldev/9-reasons-why-you-should-use-docker-as-a-development-environment-474j %}

{% github kool-dev/kool %}