Sharing: "awesome-docker-run" - Open source tool for Docker-to-IaC conversion

Issue type: Discussion/Community Project
Steps to reproduce: N/A - Sharing a community resource

Hello Docker Community,

I wanted to share an open source project I’ve been working on that addresses a common challenge many Docker users face: the transition from local Docker environments to cloud deployments.

The Technical Problem

Many of us start with simple Docker run commands or docker-compose files during development. However, when it’s time to deploy to production environments like AWS, Kubernetes, or DigitalOcean, we need to manually translate these Docker configurations into platform-specific Infrastructure as Code (IaC) templates - a process that requires learning each platform’s specific syntax.

The Technical Solution

awesome-docker-run is a repository that demonstrates how Docker run commands can be automatically transformed into various IaC formats using our docker-to-iac module.

The repository has two main components:

  1. A collection of Docker run commands for various applications, categorized by type (databases, monitoring tools, CMS, etc.)
  2. Integration with docker-to-iac to generate deployment templates for:
    • AWS CloudFormation
    • Kubernetes Helm Charts
    • DigitalOcean App Platform
    • Render.com Blueprints

Technical Implementation

The docker-to-iac module parses Docker configurations and creates properly formatted IaC templates with appropriate:

  • Container configurations
  • Port mappings
  • Environment variables
  • Volume mounts (where supported)
  • Resource allocations

Looking for Feedback

I’d appreciate technical feedback on:

  1. Are there edge cases in Docker configurations we should be handling better?
  2. Which additional cloud platforms would be most valuable to support?

The project is MIT-licensed and I welcome contributions from the Docker community.

Thanks for your time!

Hello! This sounds like a fantastic and incredibly useful project! Bridging the gap between local Docker development and cloud deployments is definitely a pain point for many. Your approach of automatically transforming docker run commands into various IaC formats has the potential to significantly streamline the deployment process.

Regarding your questions and some initial thoughts:

Feedback on Edge Cases:

  • Complex Networking Configurations: Have you considered scenarios with more intricate networking setups beyond simple port mappings? This could include custom network names, IP address assignments, or inter-container communication configurations defined in more complex docker run scenarios (though perhaps less common than docker-compose for such setups).
  • Advanced Volume Mounts: How are named volumes and more complex volume mount options (like bind mounts with specific propagation modes) handled across different platforms? The level of support for these might vary significantly.
  • Security Contexts: Docker run allows setting various security-related flags (e.g., --user, --privileged, --cap-add, --security-opt). How are these translated, or are there sensible defaults applied for the target platforms?
  • Health Checks and Restart Policies: Are the health check configurations and restart policies defined in the Docker image metadata or via docker run flags being considered for translation into platform-specific health checks and deployment strategies?
  • Resource Limits: While you mentioned resource allocations, are you handling cases where resource limits (--cpus, --memory) are specified in docker run and translating them to the appropriate resource units in the target platforms?
  • Dependencies and Initialization: For multi-container applications initiated with separate docker run commands, how are dependencies or initialization order handled in the generated IaC? This might be less of an issue if the focus is on single container deployments from docker run.

Additional Cloud Platforms to Support:

Considering the current landscape, some platforms that might be valuable additions include:

  • Google Cloud Platform (GCP): Specifically, Cloud Run (for container-native serverless) and Google Kubernetes Engine (GKE) are widely used.
  • Azure Container Instances (ACI) and Azure Kubernetes Service (AKS): Similar to AWS and GCP, Azure has significant adoption.
  • HashiCorp Nomad: For users exploring alternative orchestration platforms beyond Kubernetes.
  • Fly.io: A globally distributed platform for running full-stack apps and databases close to users.

General Observations and Potential Enhancements:

  • docker-compose Support: While the current focus is on docker run, extending the docker-to-iac module to handle basic docker-compose files in the future could be a significant expansion, as many development environments rely on it.
  • Configuration Flexibility: Providing options or configurations within docker-to-iac to allow users to customize the generated IaC (e.g., different instance sizes on AWS, specific Kubernetes resource configurations) could enhance its usability.
  • “Best Practices” Guidance: Perhaps the generated IaC could incorporate some platform-specific best practices or security recommendations.
  • Example Applications: The categorized collection of docker run commands is a great idea! Expanding this with more diverse and real-world examples would be beneficial.

Overall, this is a very promising project that tackles a real-world problem. Your initiative to open-source it and seek community feedback is commendable. I’m excited to see how this project evolves! I’ll definitely be keeping an eye on the repository.

1 Like

Well, thank you for your feedback clera :slight_smile:

Hi Rebecca,

first of all, I’d like to thank you for taking the time to read my post.

Edge Cases: I honestly overlooked this, or rather, forgot that these options exist. My focus was on the “trivial” docker run command. However, you’re absolutely right. The edge cases are also relevant and should be considered.

Additional Cloud Platforms to Support: The cloud providers you mentioned are definitely valuable for the Docker community and should be incorporated into the docker-to-iac module.

General Observations and Potential Enhancements:

  • docker-compose: A very good point. Many applications naturally have complex, or 3-tier architectures, use multiple containers.
    • Configuration Flexibility: Yes, definitely.
  • Best Practices Guidance: I will expand the documentation accordingly here: https://deploystack.io/docs
  • Example Applications: I will add new applications to the awesome-docker-run GitHub repository daily or weekly.

Thanks for the encouraging words and for providing such comprehensive feedback.