Create production-ready Docker Conda images in just one hour

You’re packaging your Conda-based Python application with Docker. And while the resulting image may run just fine on your laptop, now you need to run your code in production—which means a whole new set of worries:

  • Your Docker images are huge! Shipping a new 2GB image every time you change 3 lines of code is just wrong, not to mention slow.
  • Whenever you rebuild the image, it feels like you’ve just wasted half your day waiting for conda to resolve dependencies… and the other half of your day waiting for conda to download dependencies. Adding Docker builds to CI is going to massively slow down your team!
  • And then there’s security: you’re worried that insecure images will put your production data at risk.

You know you can’t just take your first Docker image and push it to production—you need to implement best practices.

Unfortunately, implementing Docker packaging best practices can take multiple days of development and debugging—and that’s assuming you know what you’re doing. There are no elegant abstractions when it comes to packaging—it’s just detail after detail after detail that you need to get right.

With enough research and work you can have smaller images, fast builds, and security—but you do need to got those details right. And that takes time, time you don’t have.

Smaller images, faster builds, and best practices implemented for you

Here’s where you want to be: every time you open a pull request, you want to have a new Docker image automatically built, and built quickly. Most of the time, the image should be ready in less time than it takes you to make a cup of coffee or tea.

And it should be a small image. A secure image. More broadly, an image that implements operational best practices, an image you can confidently deploy to production.

So what’s the fastest, easiest path from the prototype Docker image you’re running on your laptop to production-ready images?

Introducing the Production-Ready Conda Containers Template

The Production-Ready Conda Containers Template is the result of years of research and experience with Python, Conda, and Docker packaging, as well as my existing template for Pip-based applications.

It includes a Dockerfile, build scripts, a Python-based configuration system, GitHub Actions and GitLab CI configs, and more, all specifically designed for Conda-based Python applications. And it implements the critical best practices you need for production use, so you can package your application for Docker as quickly as possible.

Shrink your images

Docker images can be huge, especially when you’re using Conda, but the template uses a variety of techniques to keep your images small. For example:

  • A naive Docker image with Conda-installed Python and NumPy will be ~1.1 GB on disk. When using the template, the final runtime image is only 350 MB, a saving of 750MB!
  • For a real-world application, an initial tester of the template had a 50% reduction in the size of their final image.

Stop waiting, build faster

The template uses a variety of techniques to speed up builds, by utilizing:

  • Mamba, the faster Conda replacement.
  • Docker cache warming, including across branches, so Conda installs can usually be skipped.
  • The new Docker BuildKit image-building tool for faster parallel builds.

Secure your application

The template implements security practices like:

  • Running as a non-root user.
  • Updating system dependencies.
  • Automatic cacheless rebuilds to ensure system dependencies are updated, if configured appropriately in CI.

Automatic CI builds and other operational best practices

  • Includes instructions and configuration for GitHub Actions and GitLab CI.
  • Implements operational best practices like fast startup/shutdown, and labeling images for easy identification.

Easy and fast to get started

Instead of spending days on research, implementation, and testing of Docker best practices, you can simply:

  1. Run the install script. This will copy the template files into a repository with a environment.yml or conda-linux-64.lock file.
  2. Edit the newly copied script to start your program.
  3. Optionally, configure automated builds by tweaking the provided GitHub Actions or GitLab CI configuration files.

For many applications, that’s all you have to do!

The template supports both environment.yml files and the output of conda-lock (recommended). And it’s built with a thorough test framework to ensure it works correctly.

Customize to your particular needs

Because this is a template, and not an inflexible tool, you can modify it for your needs.

  • Need an extra step in the Dockerfile? Just edit the file.
  • Want to change how images are tagged? Edit the configuration file.

You have the full power of Docker and Python available to you—and most of the time, the default setup will do exactly what you want.

Licensing terms

You can use the template for an unlimited number of images, forever.

What you can’t do is redistribute the template itself. That means:

  1. You won’t be able to distribute the template as part of the source code of your project, if you send source code to customers.
  2. You won’t be able use it to package an open source project.
  3. You can however distribute runtime images created with the template, so long as they don’t include the template source code; the default configuration makes sure this is the case.

Package your application for production—today!

  • Package unlimited Conda-based applications (within your organization.)
  • Use the template forever.
  • Access to the latest release (June 2023), as well as all future updates of the template, delivered by email.
  • 100% money-back guarantee.
Buy the template for US$349

Note: I prefer not to take money from teams working on projects for (A) the military, surveillance, or national security (B) prisons or police, (C) fossil fuel extraction or blockchain. If any of these categories apply to you, please don’t purchase this product.

Separately, if you live in a low-income country, email me about purchasing price parity (PPP) discounts.

Still not sure?

Read my article on how to decide whether to buy a product, and how to convince your boss to pay for it.


June 2023, v1.0.4

  • Fixed bug where Mamba didn’t work with latest Conda; hopefully installation will be more robust now.
  • Switched to Debian Bookworm and dockerfile 1.5.

Sep 2022, v1.0.3

  • Support for conda-lock.yml files created by newer versions of conda-lock.

Jan 2022, v1.0.2

  • Improved documentation of many existing features.
  • Switch to unlimited licensing, and indefinite updates.

Dec 2021, v1.0.1

  • Better caching for faster rebuilds.
  • Improved Docker Compose documentation.

Nov 2021, v1.0

  • Initial template release.