Skip to content

Conversation

@kterui9019
Copy link

Fixes: #9321

Description
Implements docker compose deployer functionality to resolve issue #9321.

This PR adds support for deploying applications using docker compose instead of
individual containers when useCompose: true is set in the skaffold.yaml
configuration.

User facing changes (remove if N/A)
This implementation allows users to deploy applications using docker compose instead of individual containers. The compose file is automatically updated with the correct image tags built by skaffold.

How it works

  1. Skaffold builds container images as usual
  2. Reads the docker-compose.yml file
  3. Replaces image names in the compose file with built image tags
  4. Creates a temporary compose file with updated images
  5. Runs docker compose up -d with a unique project name
  6. On cleanup, runs docker compose down --volumes --remove-orphans

@kterui9019 kterui9019 requested a review from a team as a code owner October 24, 2025 03:52
@google-cla
Copy link

google-cla bot commented Oct 24, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kterui9019, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant new feature to Skaffold, enabling it to deploy applications using Docker Compose. This enhancement allows users to leverage their existing docker-compose.yml configurations for multi-service applications, integrating seamlessly with Skaffold's build and development lifecycle. The change streamlines the local development experience for Docker-based projects by automating the process of building images, updating compose files with the correct tags, and managing the lifecycle of Docker Compose deployments.

Highlights

  • Docker Compose Deployer: Skaffold now supports deploying applications using Docker Compose when useCompose: true is set in the docker deploy configuration within skaffold.yaml.
  • Automated Image Tag Replacement: Skaffold automatically reads the docker-compose.yml file, replaces image names with the tags of images built by Skaffold, and creates a temporary compose file for deployment.
  • Deployment and Cleanup Workflow: The deployment process involves running docker compose up -d with a unique project name. Cleanup is handled by docker compose down --volumes --remove-orphans.
  • Configuration and Customization: Users can specify a custom Docker Compose file location using the SKAFFOLD_COMPOSE_FILE environment variable. Image names in docker-compose.yml must match or be contained within the build.artifacts section for proper replacement.
  • Documentation and Examples: Comprehensive documentation has been added for the new Docker Compose deployer, along with new sample skaffold.yaml configurations and a complete working example.
  • Integration and Unit Tests: New integration tests have been added to verify the delete and dev commands work correctly with the Docker Compose deployer, and unit tests cover the core logic for image replacement and file path handling.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

- Add deployWithCompose() and cleanupWithCompose() methods
- Support SKAFFOLD_COMPOSE_FILE environment variable for custom compose file paths
- Automatically replace image names in compose files with skaffold-built images
- Add comprehensive unit tests with 12 test cases covering all functionality
- Add complete working example in examples/docker-compose-deploy/
- Add testdata files for unit testing
@kterui9019 kterui9019 force-pushed the feat/compose-deployer branch from c5b0b33 to cdd809e Compare October 24, 2025 03:55
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant new feature: deploying applications using Docker Compose. The changes include core implementation in the Docker deployer, extensive integration tests, a new example, and documentation updates.

My review focuses on the correctness and robustness of the new implementation. I've identified a critical issue in the deployment logic where docker compose up would be called in a loop for each artifact, which needs to be refactored. I also found a potential issue with the image name matching logic which could lead to incorrect deployments in projects with similarly named images. Additionally, I've provided some suggestions to improve the readability and efficiency of the new test helper functions.

@kterui9019 kterui9019 marked this pull request as draft October 24, 2025 07:16
@kterui9019 kterui9019 force-pushed the feat/compose-deployer branch 2 times, most recently from b0a50b3 to a655ef3 Compare October 24, 2025 07:54
@kterui9019 kterui9019 force-pushed the feat/compose-deployer branch 2 times, most recently from d936d08 to d684885 Compare October 24, 2025 08:39
@kterui9019 kterui9019 marked this pull request as ready for review October 24, 2025 09:05
@kterui9019 kterui9019 marked this pull request as draft October 24, 2025 09:06
@kterui9019 kterui9019 force-pushed the feat/compose-deployer branch from d684885 to 7a2f225 Compare October 24, 2025 09:06
@kterui9019 kterui9019 marked this pull request as ready for review October 24, 2025 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get "docker compose not yet supported by skaffold" when trying to deploy a docker container with useCompose: true

1 participant