Sustainable Dev Environments

with Docker and Bash

Build a Stable and Maintainable Place to Code

A Book by David Bryant Copeland

Dev Environments Don't Have to Suck

By using widely-understood, standardized tools for virtualization and scripting, you can have a dev environment set up in minutes.

Build a Dev Environment for any App

Install software the standard way onto a stable OS, which allows you and your team to develop your app on Linux, Mac, or even Windows!

Learn How Docker Actually Works

You'll quickly understand the difference between a container and an image…and how to safely make your own.

Confidently Automate It…with Bash!

Bash is everywhere, so level up your ability to make a great command line experience anywhere.

Fully Automated &

You'll build a truly sustainable, generic system that requires no configuration.

Out of date, heavy 🧳
✨⭐️ Where you want to be ⭐️✨
Where you are (probably)
Complex, brittle 🚧

What You Get


The paperback version is printed on-demand by Amazon and, unfortunately, cannot be bundled with the e-book version. The paperback looks and feels great, so if you prefer reading a real book, this is the way to go.

About the Author

I've been a professional programmer for over 25 years. I was most recently CTO at mental health startup Mood Health. Previously, I was the Chief Software Architect and Director of Engineering at Stitch Fix. I helped grow the engineering team and technology from 3 to 200+, establishing technology and process to help the company grow for years. I've setup and debugged a lot of dev environments.

I’m also an author of several programming books such as “Sustainable Web Development with Ruby on Rails”, “Ruby on Rails Background Jobs with Sidekiq”, “The Senior Software Engineer”, and “Build Awesome Command-Line Applications in Ruby 2”. I’ve spoken at regional and national programming conferences and have over 25 years of experience in the industry. Previously at LivingSocial and OPower.

Table of Contents

130 pages, 20 short chapters. Read a Sample.

  1. 1. Your Dev Environment Sucks

    Why are our dev environments always broken? Why is everyone's first day at a job spent in misery, following some out-of-date wiki?

  2. 2. A Dev Environment Defined

    Your dev environment is where you get work done, yes, but it's a coordinated set of tools. We'll learn exactly what they are and how the interact so they can be managed carefully.

  3. 3. The Four Types of Dev Environments

    Most of use a dev environment running on our computer, set up based on documentation. This is the worst of all worlds. Automation eliminates the need for most documentation and virtualization allows that automation to be easy to understand, easy to keep updated, and reliable to use.

    Read this chapter now

  4. 4. What is Docker and How Does It Work?

    Most people's problems with Docker stem from its difficult and inconsistent terminology, coupled with its vague documentation. This chapter will sort all that out for you.

  5. 5. Managing the Operating System With Base Images

    All work is done in an operating system, but choosing the right one, and understanding that choice, is surprisingly difficult. It won't be after this chapter. You'll get a straightforward way to know what OS you are using and how to find a safe version of it to base your work on.

  6. 6. Installing Software in the Dev Environment

    I used to follow instructions from Stack Overflow or random blog posts. Installing software in Docker doesn't have to be so fraught. This chapter details a step-by-step way to find the software vendor's installation instructions, use them, and make sure you keep using them.

  7. 7. Publishing Ports and Mounting Volumes to Do Development

    Docker ports and volumes can be daunting, but for development, we don't need them to do much. This chapter clears away everything we don't care about and will explain how Docker interacts with your computer, so you can get work done.

  8. 8. Running Databases and Caches with One Line of Code

    Docker's most powerful feature is DockerHub: a repository of ready-to-run images for any imaginable piece of software. This makes is far easier to use for running Postgres, Redis, Elasticsearch, or whatever. But the user experience isn't quite there. This chapter will give you the power to understand what you are running and how.

  9. 9. What is a Good User Experience for Automation Scripts?

    Despite its power, Docker's command-line usability isn't great. We'll make it great using Bash scripts. Bash is the only reliable scripting language on any OS and computer, so it's a great choice to turn docker compose -f docker-compose.dx.yml --env-file=dx/env up into dx/start.

  10. 10. The Arcane World of the UNIX Command Line

    The UNIX command line can be impenetrable. What are all those symbols doing? What's an output stream? Exit Codes?!?!? This chapter takes you from knowing nothing about the command line to having the vocabulary to understand documentation, examples, and even Internet blog posts.

  11. 11. Writing One Nice Script

    This is a step-by-step walkthrough for making one nice script to automate a complicated command. The script will be bulletproof, user-friendly, and run anywhere reliably. And you'll learn a bit of Bash along the way!

  12. 12. Build the Remaining Scripts

    Here, we'll build several other scripts that rely on the same code as our first one. We'll learn what you can and can't share between Bash scripts, and how to keep everything as organized and clean as possible.

  13. 13. Customizing Your Dev Environment

    Running code inside Docker can sometimes feel like being outside in the winter with no dotfiles coat. You'll learn how to leverage the scripts you've built into a protocol. This protocol allows per-developer customization without a ton of special-casing, and almost no additional documentation to maintain.

  14. 14. Sustainably Maintaining The Dev Environment

    It's one thing to build a dev environment, but another to maintain it. Here, you'll learn a repeatable series of steps to debug any Docker problem. We'll also go a bit deep on how all the images you've downloaded and built are managed…and how to keep your disk space under control.

  15. 15. There’s No Such Thing as a Free Lunch

    Everything is a trade-off. This chapter will outline the downsides of the approach we have taken, including a few hard-to-understand gotchas.

  16. 16. Tech Companies Should Not Own Your Dev Environment

    As a developer, you absolutely must control and understand your development environment. It's the most core competency you have. You can't cede that to a massive tech company or an underfunded startup. Docker and Bash give you that control.

  17. A. The Docker Lexicon for Regular People

    You can print this chapter out if, like me, you keep forgetting what the heck the “host” is.

  18. B. Bash and Command-Line Quick Reference

    Bash and Unix terms and symbols are notoriously hard to search for, and take a lot of repetition to internalize. This appendix provides a quick reference until you've put in your 10,000 hours :)

  19. C. Protocols for Dev Environments

    The scripts we built create a protocol that allows management of your dev environment. There is a Foundational Core, which is what this book is mostly about, and then a Workspace, where your specific app's needs should be automated, too.

  20. D. Colophon or, The Chapter About Fonts

    Maybe you don't care about Docker, but have a burning desire to understand what fonts are used in the cover, or what programs I use to make diagrams. Find out here!