转换结果不保证与 Compose 语义完全一致,首次上 K8s 需人工核对生成的清单;从源码构建需 Go 1.6 以上并正确设置 GOPATH;二进制需自行 chmod +x 并放入 PATH 才能直接调用

kompose
kubernetesApache-2.0活跃维护把 Docker Compose 文件直接转换成 Kubernetes 资源清单,方便本地编排的应用平滑迁移到 K8s 集群。
Convert Compose to Kubernetes
curl -L https://github.com/kubernetes/kompose/releases/download/v1.38.0/kompose-linux-amd64 -o kompose
chmod +x kompose
sudo mv ./kompose /usr/local/bin/komposeREADME 未说明硬件要求,工具本身为命令行程序,无需 GPU
把 docker-compose 文件翻译成 Kubernetes 资源清单,帮熟悉 Compose 的人快速迁移到 K8s
把 Docker Compose 文件直接转换成 Kubernetes 资源清单,方便本地编排的应用平滑迁移到 K8s 集群。
核心能力
- 读取 Compose Specification 文件并转换为 K8s 资源
- 一条命令生成 Deployment 和 Service 等 YAML 清单
- 支持 Bash、Zsh、Fish 的 shell 自动补全
- 提供二进制、Go、Homebrew、Docker 等多种安装方式
容易踩的坑
- v1.38.0最新正式版2026-01-15 · 2026-01-15 21:33 UTC
Installation
Linux and macOS:
# Linux curl -L https://github.com/kubernetes/kompose/releases/download/v1.38.0/kompose-linux-amd64 -o kompose # Linux ARM64 curl -L https://github.com/kubernetes/kompose/releases/download/v1.38.0/kompose-linux-arm64 -o kompose # macOS curl -L https://github.com/kubernetes/kompose/releases/download/v1.38.0/kompose-darwin-amd64 -o kompose # macOS ARM64 curl -L https://github.com/kubernetes/kompose/releases/download/v1.38.0/kompose-darwin-arm64 -o kompose chmod +x kompose sudo mv ./kompose /usr/local/bin/komposeWindows:
Download from GitHub and add the binary to your PATH.
Checksums:
Filename SHA256 Hash kompose-darwin-amd64 a6c663df22610dec6b005e7c93b66bb46e33161707b7bb1cbee3bcdbf09cbb34 kompose-darwin-amd64.tar.gz b0a75ea83ce64babd7ab7d7d9c6db6b55844929f6910d82d0d5b38bab2b733ad kompose-darwin-arm64 5687d79633854d5fc8151a0148fd6045b643e3f745f7413106c807fe63fe97eb kompose-darwin-arm64.tar.gz aff7b2eb9c7cd80cb19ecadaa4344a16cc153172bc236637fabb13443ad82bae kompose-linux-amd64 65a6a720605bead3964e8b22d423a0763de451a236fe03de902e366cf3d9c147 kompose-linux-amd64.tar.gz 60a1c57d15d7499226eb4045bb9a64fa598f2a8bd9f09b5c59f4ce1c74313a11 kompose-linux-arm 53119ee98adfe6fe430704876f4ad80f571733aaba4701eac1a17012efbb71c8 kompose-linux-arm.tar.gz 2888b4080f0feea623598843a61a7a0e372413c7b6fc88b5f494fc781fd81691 kompose-linux-arm64 24faf6212ec34d325e4724118098d34b9dd321cda2d9ca22efa0f04cdb909894 kompose-linux-arm64.tar.gz 10db6666f3d6d8ab183c5ecd075231fa427cf2dfc6b469d169dda4105e06dcba kompose-windows-amd64.exe 6fb08b4d73590b1467aa60b9af8d4bd308829aba2b147cc184b94738a2a736ed kompose-windows-amd64.exe.tar.gz 29a893a145819897995f40166392c8dd37e106fb27f237f791b3cef88cef33c1 SHA256_SUM 656e9e433fa129e0416a1b53417d944e5a9076d4426b09031b7def2c35e80db1 What's Changed
- chore(deps)(deps): bump github.com/spf13/pflag from 1.0.7 to 1.0.10 by @dependabot[bot] in https://github.com/kubernetes/kompose/pull/2055
- chore(ci)(deps): bump actions/checkout from 4 to 6 by @dependabot[bot] in https://github.com/kubernetes/kompose/pull/2068
- fix issue https://github.com/kubernetes/kompose/issues/2054 by @hurzelpurzel in https://github.com/kubernetes/kompose/pull/2065
- chore(deps): bump rexml from 3.3.9 to 3.4.2 in /docs by @dependabot[bot] in https://github.com/kubernetes/kompose/pull/2061
- fix: fix ci log failing with logrus by @cdrage in https://github.com/kubernetes/kompose/pull/2078
- chore(deps)(deps): bump golang.org/x/tools from 0.27.0 to 0.41.0 by @dependabot[bot] in https://github.com/kubernetes/kompose/pull/2077
- chore(deps)(deps): bump github.com/go-viper/mapstru
- v1.37.02025-08-11 · 2025-08-11 18:59 UTC
查看更新说明
Installation
Linux and macOS:
# Linux curl -L https://github.com/kubernetes/kompose/releases/download/v1.37.0/kompose-linux-amd64 -o kompose # Linux ARM64 curl -L https://github.com/kubernetes/kompose/releases/download/v1.37.0/kompose-linux-arm64 -o kompose # macOS curl -L https://github.com/kubernetes/kompose/releases/download/v1.37.0/kompose-darwin-amd64 -o kompose # macOS ARM64 curl -L https://github.com/kubernetes/kompose/releases/download/v1.37.0/kompose-darwin-arm64 -o kompose chmod +x kompose sudo mv ./kompose /usr/local/bin/komposeWindows:
Download from GitHub and add the binary to your PATH.
Checksums:
Filename SHA256 Hash kompose-darwin-amd64 7dd4f6bca15595a70f85ae15fa01f23ed94aed5f41cdd6c6ccc6ead0e4766f9d kompose-darwin-amd64.tar.gz 2cfcd33fdee2e015b5dfa8d0bbda7cbc1fc28676061243786bdb750f1ba1cf17 kompose-darwin-arm64 f859b45382f46bf85d3f564e922010142d58a23d7347015bbbcaef8b973b79d0 kompose-darwin-arm64.tar.gz b8512dc6713e6c4722843f531bb320e2ca9fe3a33393cc4b19661e2a942895f2 kompose-linux-amd64 0861a3d612d8825a530ff566a0e8fda788a46eeaa390b613561a2b557b5e6b58 kompose-linux-amd64.tar.gz c258ca7c66b9fb54a75790fafbc586180098b43cf5a155c9602a969f278e1d44 kompose-linux-arm c6b92548e6a705dc97cd9b348abd9b83969ff940035397fbdf5e31a2f859c6bf kompose-linux-arm.tar.gz 925b199327a5ffdc3506a08363569c8356035c1f3de9500e88435ca7547d468c kompose-linux-arm64 cd6fdf8f4560a936e574c11520993f2cc0afe4401b9cea01ce5d746f3cf04013 kompose-linux-arm64.tar.gz 029fcb3d885b944d3914df23491c99693e126a9638e98b0f1b4b4fddf099b07a kompose-windows-amd64.exe eafee2c48cdb9b56936f80947f195b7663b390571fb3fbe2ead935c99df4c9f2 kompose-windows-amd64.exe.tar.gz 4e7bc0e48dc6f57d873c4b19e35ea6b404022d1111ec0aaa175414ab0374222a SHA256_SUM fb3825c46abc3861504162e3da8f44028a5b722acd49913131cdb1085ca0a7be What's Changed
- refactor: use slices.Equal to simplify code by @houpo-bob in https://github.com/kubernetes/kompose/pull/2036
- chore(deps)(deps): bump github.com/spf13/pflag from 1.0.5 to 1.0.7 by @dependabot[bot] in https://github.com/kubernetes/kompose/pull/2034
- chore(deps)(deps): bump github.com/spf13/cast from 1.7.0 to 1.9.2 by @dependabot[bot] in https://github.com/kubernetes/kompose/pull/2028
- chore(deps)(deps): bump github.com/go-viper/mapstructure/v2 from 2.0.0 to 2.3.0 by @dependabot[bot] in https://github.com/kubernetes/kompose/pull/2029
- chore(deps)(deps): bump github.com/compose-spec/compose-go/v2 from 2.4.4 to 2.8.1 by @dependabot[bot] in https://github.com/kubernetes/kompose/pull/2037
- 1.37.0 Release by @cdrage in https://github.com/kubernetes/kompose/pull/2040
New Contributors
- @houpo-bob mad
- v1.36.02025-05-14 · 2025-05-14 18:22 UTC
查看更新说明
Installation
Linux and macOS:
# Linux curl -L https://github.com/kubernetes/kompose/releases/download/v1.36.0/kompose-linux-amd64 -o kompose # Linux ARM64 curl -L https://github.com/kubernetes/kompose/releases/download/v1.36.0/kompose-linux-arm64 -o kompose # macOS curl -L https://github.com/kubernetes/kompose/releases/download/v1.36.0/kompose-darwin-amd64 -o kompose # macOS ARM64 curl -L https://github.com/kubernetes/kompose/releases/download/v1.36.0/kompose-darwin-arm64 -o kompose chmod +x kompose sudo mv ./kompose /usr/local/bin/komposeWindows:
Download from GitHub and add the binary to your PATH.
Checksums:
Filename SHA256 Hash kompose-darwin-amd64 de44e3fe67a01b4080b99a4366741e9adab8a927d9f3fee8afc6a32fe6fc93c5 kompose-darwin-amd64.tar.gz a6a7848f68eced31838e014cf160a1a14a07b72adeeaf584b60eaa1730ff4f7e kompose-darwin-arm64 a0678bc4d1206884144a5273b9c7b3368afef5acfbfdee82acf6d0bb911bbf2e kompose-darwin-arm64.tar.gz 0f6e7e2567bc8098448266a7f26bfcd30b87eb0b30e49d692127a42211c87673 kompose-linux-amd64 459d86a14a2172d8384007ff296f74f3c625dde15b6c8dc971f4985891aef3a7 kompose-linux-amd64.tar.gz 80af2b304c16c42e9d558ce7aee6f9850e2e624ccd299187104e5ae91071bbad kompose-linux-arm 1f1af77ec4489de19029d59c62a99569d506fc8c4be0ca272b8bb0c76840d04b kompose-linux-arm.tar.gz 6f1795436592eb2029762e7b432e641239b4624c52c5c32f01f46d7423f382a9 kompose-linux-arm64 27a07a05c10e9414d837c4cf578c8bdd4c8ec28aa606ffcb781c252f363806fe kompose-linux-arm64.tar.gz 31d0edf5fb035119aa80a924bda13e1e8b61d53c64056985447d44f1b8a24c02 kompose-windows-amd64.exe cc9fe74bafbcd0ab4df74868e335ab48780d81344b6ae8c4a416861f88a63548 kompose-windows-amd64.exe.tar.gz 7bc06ab69b30126ee9aafe3e7d23ee765ec4e22675e098fcd50dd1c6204e6dd3 SHA256_SUM df9c53913d646c9ffd13e6ae1ba46ab40d434a03919fce51ab1b88f449239544 What's Changed
- Replaced y with ✓ by @alf in https://github.com/kubernetes/kompose/pull/1975
- Add no-interpolate feature option to the CLI by @jvitor83 in https://github.com/kubernetes/kompose/pull/1955
- update typo in kompose.volume.subpath by @kundan2707 in https://github.com/kubernetes/kompose/pull/1998
- Fix case of FromAs by @gisostallenberg in https://github.com/kubernetes/kompose/pull/1993
- Improve command to run in docker by @gisostallenberg in https://github.com/kubernetes/kompose/pull/1994
- Fix ConfigMap name clash if env_file name is equal by @robertaistleitner in https://github.com/kubernetes/kompose/pull/2001
- fix: resolve env_file variable interpolation issues by adding support… by @yuefanxiao in https://github.com/kubernetes/kompose/pull/2011
- fix: Load variables from .env file by default by @yue
- v1.35.02024-12-12 · 2024-12-12 14:04 UTC
查看更新说明
Installation
Linux and macOS:
# Linux curl -L https://github.com/kubernetes/kompose/releases/download/v1.35.0/kompose-linux-amd64 -o kompose # Linux ARM64 curl -L https://github.com/kubernetes/kompose/releases/download/v1.35.0/kompose-linux-arm64 -o kompose # macOS curl -L https://github.com/kubernetes/kompose/releases/download/v1.35.0/kompose-darwin-amd64 -o kompose # macOS ARM64 curl -L https://github.com/kubernetes/kompose/releases/download/v1.35.0/kompose-darwin-arm64 -o kompose chmod +x kompose sudo mv ./kompose /usr/local/bin/komposeWindows:
Download from GitHub and add the binary to your PATH.
Checksums:
Filename SHA256 Hash SHA256_SUM e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 kompose-darwin-amd64 dc22f45df7aeb8ca440a56560a57bb22af016a6cbb63dd3509d1abdf9390ef63 kompose-darwin-amd64.tar.gz 8546d23eb0e3b688af273d61eeef8aef70786036a053dc5830c5b6fb528ce906 kompose-darwin-arm64 60e73d7b24c6ac10fcf6efbc1159d0e2d64e38878e57e8a088e159dc5c9567d0 kompose-darwin-arm64.tar.gz 18e6846ab101ba0029e96ac498a0e3c61c9b11ccdb5d9e3e09e86a00f640d5e9 kompose-linux-amd64 d7de6c93ef083b668cdcf11bb7ebf739f853952ad229c4afcbbda5af7a480672 kompose-linux-amd64.tar.gz 4185c0cdfcb8bcc3dfe72dad2874c5ef5956934df54168b29c322eceba463a7b kompose-linux-arm 479cb5aaeb18f1141da7bed9193a696d3afaf6f31047520d11d1df3cf4588264 kompose-linux-arm.tar.gz 897816cd903988effb212e263ffa7a311384a8eec8e4f8ca6aa74f9aa88acb01 kompose-linux-arm64 4ae1893bb7288ce20add71fd2dfc34094cb7359dc40beed3da0919d31c331ded kompose-linux-arm64.tar.gz 922b393417dd5b66b919af639c69abbcd55ccdfe54f865fa139b0bcf55771547 kompose-windows-amd64.exe fe9bd337420dbeebb429fd847f9f6bca833d26a44ca1e8670e90c181fe05397a kompose-windows-amd64.exe.tar.gz 70590b8477290138da7c15cf405057a2befeab33e05335c9104285a8421c7ed0 What's Changed
- chore: upgrade fsouza/godockerclient and docker/docker packages by @TessaIO in https://github.com/kubernetes/kompose/pull/1921
- chore(deps)(deps): bump github.com/spf13/cast from 1.6.0 to 1.7.0 by @dependabot in https://github.com/kubernetes/kompose/pull/1920
- chore(deps)(deps): bump github.com/compose-spec/compose-go/v2 from 2.1.0 to 2.1.6 by @dependabot in https://github.com/kubernetes/kompose/pull/1919
- chore(deps)(deps): bump golang.org/x/tools from 0.20.0 to 0.24.0 by @dependabot in https://github.com/kubernetes/kompose/pull/1918
- chore(deps)(deps): bump k8s.io/apimachinery from 0.30.0 to 0.30.3 by @dependabot in https://github.com/kubernetes/kompose/pull/1911
- chore(deps)(deps): bump k8s.io/api from 0.30.0 to 0.30.3 by @dependabot in https://github.com/kubernetes/kompose/pull/1910
- feature
- v1.34.02024-06-02 · 2024-06-02 23:24 UTC
查看更新说明
Installation
Linux and macOS:
# Linux curl -L https://github.com/kubernetes/kompose/releases/download/v1.34.0/kompose-linux-amd64 -o kompose # Linux ARM64 curl -L https://github.com/kubernetes/kompose/releases/download/v1.34.0/kompose-linux-arm64 -o kompose # macOS curl -L https://github.com/kubernetes/kompose/releases/download/v1.34.0/kompose-darwin-amd64 -o kompose # macOS ARM64 curl -L https://github.com/kubernetes/kompose/releases/download/v1.34.0/kompose-darwin-arm64 -o kompose chmod +x kompose sudo mv ./kompose /usr/local/bin/komposeWindows:
Download from GitHub and add the binary to your PATH.
Checksums:
Filename SHA256 Hash SHA256_SUM e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 kompose-darwin-amd64 de0b895e78cea70ca361ec740b943e0f6bbacd5ef46903e1f2d0aaf95055a8ed kompose-darwin-amd64.tar.gz ecbf985cdc71b07911e7a8f8f3a11911ac95a40af0ccb92dfd2ca8cfdefbe3dc kompose-darwin-arm64 88d76d77b801853651067a4624fe1e58692f112dfbb68cf6b3d680c3cb1475e3 kompose-darwin-arm64.tar.gz a682b630164314418db7095ec6ba74db29ddcd73c4f723cf95935b2206b9fdd9 kompose-linux-amd64 c58d0e63ef6bf8a98fc9840025b943f50f2d0ad807b2f8d55db92cea869ee171 kompose-linux-amd64.tar.gz 850c82c65c18c8600985ada6d7cdf28ae183cd667f4d5b699ba70c84e168a1a8 kompose-linux-arm 2f2367bc37a31df926605b92ae12d4eb10cc09b2a0ece72fdccf1d7e2863cb16 kompose-linux-arm.tar.gz 0ce69c0989dec6946077790dca27940bfbc22506c8e927deea031bd8e4d86a58 kompose-linux-arm64 76fa45cbdb3ee32bb925db932abb5ca50c020781f8a121d0cabedfa5d31cc8e6 kompose-linux-arm64.tar.gz 10c4727638943323d544ae59f27635731e39856c102a0140a11b636bab9c5e6c kompose-windows-amd64.exe c130937a8e290eec23d8f8be9864896d3453ddd2fda4e5853c923c9460b2795f kompose-windows-amd64.exe.tar.gz eadc19eb47ac57e3869a8d7dde8aa150d4afab02260fac2c9403c0dfd4dbac43 What's Changed
- update references to just compose by @cdrage in https://github.com/kubernetes/kompose/pull/1869
- feature: change example to use non-root by @cdrage in https://github.com/kubernetes/kompose/pull/1879
- fix: expose container to host only with labels by @TessaIO in https://github.com/kubernetes/kompose/pull/1880
- update owners by @cdrage in https://github.com/kubernetes/kompose/pull/1888
- chore: fix test file names by @cdrage in https://github.com/kubernetes/kompose/pull/1889
- tests: fix flakey tests by @cdrage in https://github.com/kubernetes/kompose/pull/1886
- bug: fix annotation bug by @cdrage in https://github.com/kubernetes/kompose/pull/1887
- cleanup: removes uneeded annotation when not using network policy by @cdrage in https://github.com/kubernetes/kompose/pull/1884
- docs: update user guide
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Kompose (Kubernetes + Compose)

kompose is a tool to help users who are familiar with docker-compose move to Kubernetes. kompose takes a Compose Specification file and translates it into Kubernetes resources.
kompose is a convenience tool to go from local Compose environment to managing your application with Kubernetes. Transformation of the Compose Specification format to Kubernetes resources manifest may not be exact, but it helps tremendously when first deploying an application on Kubernetes.
Use Case
Convert compose.yaml into Kubernetes deployments and services with one simple command:
$ kompose convert -f compose.yaml
INFO Kubernetes file "frontend-service.yaml" created
INFO Kubernetes file "redis-leader-service.yaml" created
INFO Kubernetes file "redis-replica-service.yaml" created
INFO Kubernetes file "frontend-deployment.yaml" created
INFO Kubernetes file "redis-leader-deployment.yaml" created
INFO Kubernetes file "redis-replica-deployment.yaml" created
Other examples are provided in the examples directory.
Installation
We have multiple ways to install Kompose. Our preferred method is downloading the binary from the latest GitHub release.
Our entire list of installation methods are located in our installation.md document.
Installation methods:
Binary installation
Kompose is released via GitHub on a three-week cycle, you can see all current releases on the GitHub release page.
Linux and macOS:
# Linux
curl -L https://github.com/kubernetes/kompose/releases/download/v1.38.0/kompose-linux-amd64 -o kompose
# macOS
curl -L https://github.com/kubernetes/kompose/releases/download/v1.38.0/kompose-darwin-amd64 -o kompose
chmod +x kompose
sudo mv ./kompose /usr/local/bin/kompose
Windows:
Download from GitHub and add the binary to your PATH.
Shell autocompletion
We support Bash, Zsh and Fish autocompletion.
# Bash (add to .bashrc for persistence)
source <(kompose completion bash)
# Zsh (add to .zshrc for persistence)
source <(kompose completion zsh)
# Fish autocompletion
kompose completion fish | source
Development and building of Kompose
Building with go
Requisites:
- make
- Golang v1.6 or later
- Set
GOPATHcorrectly or click SettingGOPATH for details
Steps:
- Clone repository
$ git clone https://github.com/kubernetes/kompose.git $GOPATH/src/github.com/kubernetes/kompose
- Change directory to the cloned repo.
cd $GOPATH/src/github.com/kubernetes/kompose
- Build with
make
$ make bin
- Or build with
go
$ go build -o kompose main.go
- Test your changes
$ make test
Documentation
Documentation can be found at our kompose.io website or our docs folder.
Here is a list of all available docs:
Community, Discussion, Contribution, and Support
Issues: If you find any issues, please file it.
Kubernetes Community: As part of the Kubernetes ecosystem, we follow the Kubernetes community principles. More information can be found on the community page.
Chat (Slack): We're fairly active on Slack and you can find us in the #kompose channel.
Code of Conduct
Participation in the Kubernetes community is governed by the Kubernetes Code of Conduct.