├── .dockerignore ├── .gitattributes ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ └── feature_request.yaml ├── PULL_REQUEST_TEMPLATE.md ├── SECURITY.md ├── dependabot.yml ├── stale.yml └── workflows │ ├── ci.yml │ ├── docs-upstream.yml │ ├── merge.yml │ ├── scorecards.yml │ └── stale.yml ├── .gitignore ├── .golangci.yml ├── BUILDING.md ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── MAINTAINERS ├── Makefile ├── NOTICE ├── README.md ├── cmd ├── cmdtrace │ ├── cmd_span.go │ └── cmd_span_test.go ├── compatibility │ ├── convert.go │ └── convert_test.go ├── compose │ ├── alpha.go │ ├── attach.go │ ├── bridge.go │ ├── build.go │ ├── commit.go │ ├── completion.go │ ├── compose.go │ ├── compose_test.go │ ├── config.go │ ├── cp.go │ ├── create.go │ ├── create_test.go │ ├── down.go │ ├── events.go │ ├── exec.go │ ├── export.go │ ├── generate.go │ ├── images.go │ ├── kill.go │ ├── list.go │ ├── logs.go │ ├── options.go │ ├── options_test.go │ ├── pause.go │ ├── port.go │ ├── ps.go │ ├── ps_test.go │ ├── publish.go │ ├── pull.go │ ├── pullOptions_test.go │ ├── push.go │ ├── remove.go │ ├── restart.go │ ├── run.go │ ├── scale.go │ ├── start.go │ ├── stats.go │ ├── stop.go │ ├── top.go │ ├── top_test.go │ ├── up.go │ ├── up_test.go │ ├── version.go │ ├── version_test.go │ ├── viz.go │ ├── viz_test.go │ ├── wait.go │ └── watch.go ├── formatter │ ├── ansi.go │ ├── colors.go │ ├── consts.go │ ├── container.go │ ├── formatter.go │ ├── formatter_test.go │ ├── json.go │ ├── logs.go │ ├── multierrformat.go │ ├── pretty.go │ └── shortcut.go └── main.go ├── codecov.yml ├── docker-bake.hcl ├── docs ├── examples │ └── provider.go ├── extension.md ├── reference │ ├── compose.md │ ├── compose_alpha.md │ ├── compose_alpha_dry-run.md │ ├── compose_alpha_generate.md │ ├── compose_alpha_publish.md │ ├── compose_alpha_scale.md │ ├── compose_alpha_viz.md │ ├── compose_alpha_watch.md │ ├── compose_attach.md │ ├── compose_bridge.md │ ├── compose_bridge_convert.md │ ├── compose_bridge_transformations.md │ ├── compose_bridge_transformations_create.md │ ├── compose_bridge_transformations_list.md │ ├── compose_build.md │ ├── compose_commit.md │ ├── compose_config.md │ ├── compose_cp.md │ ├── compose_create.md │ ├── compose_down.md │ ├── compose_events.md │ ├── compose_exec.md │ ├── compose_export.md │ ├── compose_images.md │ ├── compose_kill.md │ ├── compose_logs.md │ ├── compose_ls.md │ ├── compose_pause.md │ ├── compose_port.md │ ├── compose_ps.md │ ├── compose_publish.md │ ├── compose_pull.md │ ├── compose_push.md │ ├── compose_restart.md │ ├── compose_rm.md │ ├── compose_run.md │ ├── compose_scale.md │ ├── compose_start.md │ ├── compose_stats.md │ ├── compose_stop.md │ ├── compose_top.md │ ├── compose_unpause.md │ ├── compose_up.md │ ├── compose_version.md │ ├── compose_wait.md │ ├── compose_watch.md │ ├── docker_compose.yaml │ ├── docker_compose_alpha.yaml │ ├── docker_compose_alpha_dry-run.yaml │ ├── docker_compose_alpha_generate.yaml │ ├── docker_compose_alpha_publish.yaml │ ├── docker_compose_alpha_scale.yaml │ ├── docker_compose_alpha_viz.yaml │ ├── docker_compose_alpha_watch.yaml │ ├── docker_compose_attach.yaml │ ├── docker_compose_bridge.yaml │ ├── docker_compose_bridge_convert.yaml │ ├── docker_compose_bridge_transformations.yaml │ ├── docker_compose_bridge_transformations_create.yaml │ ├── docker_compose_bridge_transformations_list.yaml │ ├── docker_compose_build.yaml │ ├── docker_compose_commit.yaml │ ├── docker_compose_config.yaml │ ├── docker_compose_convert.yaml │ ├── docker_compose_cp.yaml │ ├── docker_compose_create.yaml │ ├── docker_compose_down.yaml │ ├── docker_compose_events.yaml │ ├── docker_compose_exec.yaml │ ├── docker_compose_export.yaml │ ├── docker_compose_images.yaml │ ├── docker_compose_kill.yaml │ ├── docker_compose_logs.yaml │ ├── docker_compose_ls.yaml │ ├── docker_compose_pause.yaml │ ├── docker_compose_port.yaml │ ├── docker_compose_ps.yaml │ ├── docker_compose_publish.yaml │ ├── docker_compose_pull.yaml │ ├── docker_compose_push.yaml │ ├── docker_compose_restart.yaml │ ├── docker_compose_rm.yaml │ ├── docker_compose_run.yaml │ ├── docker_compose_scale.yaml │ ├── docker_compose_start.yaml │ ├── docker_compose_stats.yaml │ ├── docker_compose_stop.yaml │ ├── docker_compose_top.yaml │ ├── docker_compose_unpause.yaml │ ├── docker_compose_up.yaml │ ├── docker_compose_version.yaml │ ├── docker_compose_wait.yaml │ └── docker_compose_watch.yaml └── yaml │ └── main │ └── generate.go ├── go.mod ├── go.sum ├── internal ├── desktop │ ├── client.go │ ├── client_test.go │ └── discovery.go ├── experimental │ └── experimental.go ├── locker │ ├── pidfile.go │ ├── pidfile_unix.go │ ├── pidfile_windows.go │ ├── runtime.go │ ├── runtime_darwin.go │ ├── runtime_unix.go │ └── runtime_windows.go ├── memnet │ ├── conn.go │ ├── conn_unix.go │ └── conn_windows.go ├── ocipush │ └── push.go ├── paths │ └── paths.go ├── sync │ ├── shared.go │ └── tar.go ├── tracing │ ├── attributes.go │ ├── attributes_test.go │ ├── docker_context.go │ ├── errors.go │ ├── keyboard_metrics.go │ ├── mux.go │ ├── tracing.go │ ├── tracing_test.go │ └── wrap.go └── variables.go ├── logo.png └── pkg ├── api ├── api.go ├── api_test.go ├── dryrunclient.go ├── errors.go ├── errors_test.go ├── io.go └── labels.go ├── bridge ├── convert.go └── transformers.go ├── compose ├── attach.go ├── attach_service.go ├── build.go ├── build_bake.go ├── build_buildkit.go ├── build_classic.go ├── build_test.go ├── commit.go ├── compose.go ├── container.go ├── containers.go ├── convergence.go ├── convergence_test.go ├── convert.go ├── cp.go ├── create.go ├── create_test.go ├── dependencies.go ├── dependencies_test.go ├── desktop.go ├── down.go ├── down_test.go ├── envresolver.go ├── envresolver_test.go ├── events.go ├── exec.go ├── export.go ├── filters.go ├── generate.go ├── hash.go ├── hash_test.go ├── hook.go ├── image_pruner.go ├── images.go ├── images_test.go ├── kill.go ├── kill_test.go ├── logs.go ├── logs_test.go ├── ls.go ├── ls_test.go ├── pause.go ├── plugins.go ├── plugins_windows.go ├── port.go ├── printer.go ├── ps.go ├── ps_test.go ├── publish.go ├── publish_test.go ├── pull.go ├── push.go ├── remove.go ├── restart.go ├── run.go ├── scale.go ├── secrets.go ├── start.go ├── stop.go ├── stop_test.go ├── suffix_unix.go ├── testdata │ ├── compose.yaml │ └── publish │ │ ├── common.yaml │ │ └── compose.yaml ├── top.go ├── transform │ ├── replace.go │ └── replace_test.go ├── up.go ├── viz.go ├── viz_test.go ├── wait.go ├── watch.go └── watch_test.go ├── e2e ├── assert.go ├── bridge_test.go ├── build_test.go ├── cancel_test.go ├── cascade_test.go ├── commit_test.go ├── compose_environment_test.go ├── compose_exec_test.go ├── compose_run_test.go ├── compose_test.go ├── compose_up_test.go ├── config_test.go ├── configs_test.go ├── container_name_test.go ├── cp_test.go ├── e2e_config_plugin.go ├── e2e_config_standalone.go ├── env_file_test.go ├── export_test.go ├── fixtures │ ├── attach-restart │ │ └── compose.yaml │ ├── bridge │ │ ├── Dockerfile │ │ ├── compose.yaml │ │ ├── expected-helm │ │ │ ├── Chart.yaml │ │ │ ├── templates │ │ │ │ ├── 0-bridge-namespace.yaml │ │ │ │ ├── bridge-configs.yaml │ │ │ │ ├── my-secrets-secret.yaml │ │ │ │ ├── private-network-network-policy.yaml │ │ │ │ ├── public-network-network-policy.yaml │ │ │ │ ├── serviceA-deployment.yaml │ │ │ │ ├── serviceA-expose.yaml │ │ │ │ ├── serviceA-service.yaml │ │ │ │ ├── serviceB-deployment.yaml │ │ │ │ ├── serviceB-expose.yaml │ │ │ │ └── serviceB-service.yaml │ │ │ └── values.yaml │ │ ├── expected-kubernetes │ │ │ ├── base │ │ │ │ ├── 0-bridge-namespace.yaml │ │ │ │ ├── bridge-configs.yaml │ │ │ │ ├── kustomization.yaml │ │ │ │ ├── my-secrets-secret.yaml │ │ │ │ ├── private-network-network-policy.yaml │ │ │ │ ├── public-network-network-policy.yaml │ │ │ │ ├── serviceA-deployment.yaml │ │ │ │ ├── serviceA-expose.yaml │ │ │ │ ├── serviceA-service.yaml │ │ │ │ ├── serviceB-deployment.yaml │ │ │ │ ├── serviceB-expose.yaml │ │ │ │ └── serviceB-service.yaml │ │ │ └── overlays │ │ │ │ └── desktop │ │ │ │ ├── kustomization.yaml │ │ │ │ ├── serviceA-service.yaml │ │ │ │ └── serviceB-service.yaml │ │ ├── my-config.txt │ │ └── not-so-secret.txt │ ├── build-dependencies │ │ ├── base.dockerfile │ │ ├── classic.yaml │ │ ├── compose-depends_on.yaml │ │ ├── compose.yaml │ │ ├── hello.txt │ │ └── service.dockerfile │ ├── build-infinite │ │ ├── compose.yaml │ │ └── service1 │ │ │ └── Dockerfile │ ├── build-test │ │ ├── compose.yaml │ │ ├── entitlements │ │ │ ├── Dockerfile │ │ │ └── compose.yaml │ │ ├── multi-args │ │ │ ├── Dockerfile │ │ │ └── compose.yaml │ │ ├── nginx-build │ │ │ ├── Dockerfile │ │ │ └── static │ │ │ │ └── index.html │ │ ├── nginx-build2 │ │ │ ├── Dockerfile │ │ │ └── static2 │ │ │ │ └── index.html │ │ ├── platforms │ │ │ ├── Dockerfile │ │ │ ├── compose-multiple-platform-builds.yaml │ │ │ ├── compose-service-platform-and-no-build-platforms.yaml │ │ │ ├── compose-service-platform-not-in-build-platforms.yaml │ │ │ ├── compose-unsupported-platform.yml │ │ │ ├── compose.yaml │ │ │ ├── contextServiceA │ │ │ │ └── Dockerfile │ │ │ ├── contextServiceB │ │ │ │ └── Dockerfile │ │ │ └── contextServiceC │ │ │ │ └── Dockerfile │ │ ├── privileged │ │ │ ├── Dockerfile │ │ │ └── compose.yaml │ │ ├── secrets │ │ │ ├── Dockerfile │ │ │ ├── compose.yml │ │ │ └── secret.txt │ │ ├── ssh │ │ │ ├── Dockerfile │ │ │ ├── compose-without-ssh.yaml │ │ │ ├── compose.yaml │ │ │ ├── fake_rsa │ │ │ └── fake_rsa.pub │ │ └── tags │ │ │ ├── Dockerfile │ │ │ └── compose.yaml │ ├── cascade │ │ └── compose.yaml │ ├── commit │ │ └── compose.yaml │ ├── compose-pull │ │ ├── duplicate-images │ │ │ └── compose.yaml │ │ ├── image-present-locally │ │ │ └── compose.yaml │ │ ├── no-image-name-given │ │ │ └── compose.yaml │ │ ├── simple │ │ │ └── compose.yaml │ │ └── unknown-image │ │ │ ├── Dockerfile │ │ │ └── compose.yaml │ ├── config │ │ └── compose.yaml │ ├── configs │ │ ├── compose.yaml │ │ └── config.txt │ ├── container_name │ │ └── compose.yaml │ ├── cp-test │ │ ├── compose.yaml │ │ ├── cp-folder │ │ │ └── cp-me.txt │ │ └── cp-me.txt │ ├── dependencies │ │ ├── Dockerfile │ │ ├── compose.yaml │ │ ├── dependency-exit.yaml │ │ ├── deps-completed-successfully.yaml │ │ ├── deps-not-required.yaml │ │ ├── recreate-no-deps.yaml │ │ └── service-image-depends-on.yaml │ ├── dotenv │ │ ├── .env │ │ ├── .env.raw │ │ ├── development │ │ │ ├── .env │ │ │ └── compose.yaml │ │ └── raw.yaml │ ├── env-secret │ │ ├── child │ │ │ └── compose.yaml │ │ ├── compose.yaml │ │ └── secret.env │ ├── env_file │ │ ├── compose.yaml │ │ └── test.env │ ├── environment │ │ ├── empty-variable │ │ │ ├── Dockerfile │ │ │ └── compose.yaml │ │ ├── env-file-comments │ │ │ ├── .env │ │ │ ├── Dockerfile │ │ │ └── compose.yaml │ │ ├── env-interpolation-default-value │ │ │ ├── .env │ │ │ └── compose.yaml │ │ ├── env-interpolation │ │ │ ├── .env │ │ │ └── compose.yaml │ │ └── env-priority │ │ │ ├── .env │ │ │ ├── .env.empty │ │ │ ├── .env.override │ │ │ ├── .env.override.with.default │ │ │ ├── Dockerfile │ │ │ ├── compose-with-env-file.yaml │ │ │ ├── compose-with-env.yaml │ │ │ └── compose.yaml │ ├── export │ │ └── compose.yaml │ ├── external │ │ └── compose.yaml │ ├── init-container │ │ └── compose.yaml │ ├── ipam │ │ └── compose.yaml │ ├── ipc-test │ │ └── compose.yaml │ ├── links │ │ └── compose.yaml │ ├── logging-driver │ │ └── compose.yaml │ ├── logs-test │ │ ├── cat.yaml │ │ ├── compose.yaml │ │ └── restart.yaml │ ├── nested │ │ ├── .env │ │ ├── compose.yaml │ │ └── sub │ │ │ └── .env │ ├── network-alias │ │ └── compose.yaml │ ├── network-interface-name │ │ └── compose.yaml │ ├── network-links │ │ └── compose.yaml │ ├── network-test │ │ ├── compose.subnet.yaml │ │ ├── compose.yaml │ │ └── mac_address.yaml │ ├── no-deps │ │ ├── network-mode.yaml │ │ └── volume-from.yaml │ ├── orphans │ │ ├── .env │ │ └── compose.yaml │ ├── pause │ │ └── compose.yaml │ ├── port-range │ │ └── compose.yaml │ ├── profiles │ │ ├── compose.yaml │ │ ├── docker-compose.yaml │ │ └── test-profile.env │ ├── project-volume-bind-test │ │ └── docker-compose.yml │ ├── ps-test │ │ └── compose.yaml │ ├── publish │ │ ├── Dockerfile │ │ ├── common.yaml │ │ ├── compose-bind-mount.yml │ │ ├── compose-build-only.yml │ │ ├── compose-env-file.yml │ │ ├── compose-environment.yml │ │ ├── compose-local-include.yml │ │ ├── compose-multi-env-config.yml │ │ ├── compose-sensitive.yml │ │ ├── compose-with-extends.yml │ │ ├── config.txt │ │ ├── publish-sensitive.env │ │ ├── publish.env │ │ └── secret.txt │ ├── recreate-volumes │ │ ├── bind.yaml │ │ ├── compose.yaml │ │ └── compose2.yaml │ ├── resources │ │ └── compose.yaml │ ├── restart-test │ │ ├── compose-depends-on.yaml │ │ └── compose.yaml │ ├── run-test │ │ ├── compose.yaml │ │ ├── deps.yaml │ │ ├── orphan.yaml │ │ ├── ports.yaml │ │ ├── pull.yaml │ │ ├── quiet-pull.yaml │ │ └── run.env │ ├── scale │ │ ├── Dockerfile │ │ ├── build.yaml │ │ └── compose.yaml │ ├── sentences │ │ └── compose.yaml │ ├── simple-build-test │ │ ├── compose-interpolate.yaml │ │ ├── compose.yaml │ │ └── nginx-build │ │ │ ├── Dockerfile │ │ │ └── static │ │ │ └── index.html │ ├── simple-composefile │ │ ├── compose.yaml │ │ └── id.yaml │ ├── start-fail │ │ ├── compose.yaml │ │ └── start-depends_on-long-lived.yaml │ ├── start-stop │ │ ├── compose.yaml │ │ ├── other.yaml │ │ └── start-stop-deps.yaml │ ├── start_interval │ │ └── compose.yaml │ ├── stdout-stderr │ │ ├── compose.yaml │ │ └── log_to_stderr.sh │ ├── switch-volumes │ │ ├── compose.yaml │ │ └── compose2.yaml │ ├── ups-deps-stop │ │ ├── compose.yaml │ │ └── orphan.yaml │ ├── volume-test │ │ ├── compose.yaml │ │ ├── nginx-build │ │ │ └── Dockerfile │ │ └── static │ │ │ └── index.html │ ├── volumes │ │ └── compose.yaml │ ├── wait │ │ └── compose.yaml │ ├── watch │ │ ├── compose.yaml │ │ ├── config │ │ │ └── file.config │ │ ├── dat │ │ │ └── meow.dat │ │ ├── data-logs │ │ │ └── server.log │ │ ├── data │ │ │ └── hello.txt │ │ ├── exec.yaml │ │ ├── include.yaml │ │ ├── rebuild.yaml │ │ └── with-external-network.yaml │ └── wrong-composefile │ │ ├── build-error.yml │ │ ├── compose.yaml │ │ ├── service1 │ │ └── Dockerfile │ │ └── unknown-image.yml ├── framework.go ├── healthcheck_test.go ├── ipc_test.go ├── logs_test.go ├── main_test.go ├── networks_test.go ├── noDeps_test.go ├── orphans_test.go ├── pause_test.go ├── profiles_test.go ├── ps_test.go ├── publish_test.go ├── pull_test.go ├── recreate_no_deps_test.go ├── restart_test.go ├── scale_test.go ├── secrets_test.go ├── start_stop_test.go ├── up_test.go ├── volumes_test.go ├── wait_test.go └── watch_test.go ├── mocks ├── mock_docker_api.go ├── mock_docker_cli.go └── mock_docker_compose_api.go ├── progress ├── colors.go ├── event.go ├── json.go ├── noop.go ├── plain.go ├── quiet.go ├── spinner.go ├── tty.go ├── tty_test.go ├── writer.go └── writer_test.go ├── prompt ├── prompt.go └── prompt_mock.go ├── remote ├── cache.go ├── cache_darwin.go ├── cache_unix.go ├── cache_windows.go ├── git.go └── oci.go ├── utils ├── durationutils.go ├── safebuffer.go ├── set.go ├── set_test.go ├── stringutils.go ├── writer.go └── writer_test.go └── watch ├── debounce.go ├── debounce_test.go ├── dockerignore.go ├── dockerignore_test.go ├── ephemeral.go ├── ephemeral_test.go ├── notify.go ├── notify_test.go ├── paths.go ├── paths_test.go ├── temp.go ├── temp_dir_fixture.go ├── watcher_darwin.go ├── watcher_naive.go ├── watcher_naive_test.go ├── watcher_nonwin.go └── watcher_windows.go /.dockerignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | core.autocrlf false 2 | *.golden text eol=lf 3 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # global rules 2 | * @docker/compose-maintainers -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Docker Community Slack 4 | url: https://dockr.ly/slack 5 | about: 'Use the #docker-compose channel' 6 | - name: Docker Support Forums 7 | url: https://forums.docker.com/c/open-source-projects/compose/15 8 | about: 'Use the "Open Source Projects > Compose" category' 9 | - name: 'Ask on Stack Overflow' 10 | url: https://stackoverflow.com/questions/tagged/docker-compose 11 | about: 'Use the [docker-compose] tag when creating new questions' 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yaml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Missing functionality? Come tell us about it! 3 | labels: 4 | - kind/feature 5 | - status/0-triage 6 | body: 7 | - type: textarea 8 | id: description 9 | attributes: 10 | label: Description 11 | description: What is the feature you want to see? 12 | validations: 13 | required: true 14 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **What I did** 2 | 3 | **Related issue** 4 | 5 | 6 | **(not mandatory) A picture of a cute animal, if possible in relation to what you did** 7 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: gomod 4 | directory: / 5 | schedule: 6 | interval: daily 7 | ignore: 8 | # docker + moby deps require coordination 9 | - dependency-name: "github.com/docker/buildx" 10 | # buildx is still 0.x 11 | update-types: ["version-update:semver-minor"] 12 | - dependency-name: "github.com/moby/buildkit" 13 | # buildkit is still 0.x 14 | update-types: [ "version-update:semver-minor" ] 15 | - dependency-name: "github.com/docker/cli" 16 | update-types: ["version-update:semver-major"] 17 | - dependency-name: "github.com/docker/docker" 18 | update-types: ["version-update:semver-major"] 19 | - dependency-name: "github.com/containerd/containerd" 20 | # containerd major/minor must be kept in sync with moby 21 | update-types: [ "version-update:semver-major", "version-update:semver-minor" ] 22 | # OTEL dependencies should be upgraded in sync with engine, cli, buildkit and buildx projects 23 | - dependency-name: "go.opentelemetry.io/*" 24 | -------------------------------------------------------------------------------- /.github/workflows/docs-upstream.yml: -------------------------------------------------------------------------------- 1 | # this workflow runs the remote validate bake target from docker/docs 2 | # to check if yaml reference docs used in this repo are valid 3 | name: docs-upstream 4 | 5 | # Default to 'contents: read', which grants actions to read commits. 6 | # 7 | # If any permission is set, any permission not included in the list is 8 | # implicitly set to "none". 9 | # 10 | # see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions 11 | permissions: 12 | contents: read 13 | 14 | concurrency: 15 | group: ${{ github.workflow }}-${{ github.ref }} 16 | cancel-in-progress: true 17 | 18 | on: 19 | push: 20 | branches: 21 | - 'main' 22 | - 'v[0-9]*' 23 | paths: 24 | - '.github/workflows/docs-upstream.yml' 25 | - 'docs/**' 26 | pull_request: 27 | paths: 28 | - '.github/workflows/docs-upstream.yml' 29 | - 'docs/**' 30 | 31 | jobs: 32 | docs-yaml: 33 | runs-on: ubuntu-latest 34 | steps: 35 | - 36 | name: Checkout 37 | uses: actions/checkout@v4 38 | - 39 | name: Upload reference YAML docs 40 | uses: actions/upload-artifact@v4 41 | with: 42 | name: docs-yaml 43 | path: docs/reference 44 | retention-days: 1 45 | 46 | validate: 47 | uses: docker/docs/.github/workflows/validate-upstream.yml@main 48 | needs: 49 | - docs-yaml 50 | with: 51 | module-name: docker/compose 52 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: 'Close stale issues' 2 | 3 | # Default to 'contents: read', which grants actions to read commits. 4 | # 5 | # If any permission is set, any permission not included in the list is 6 | # implicitly set to "none". 7 | # 8 | # see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions 9 | permissions: 10 | contents: read 11 | 12 | on: 13 | schedule: 14 | - cron: '0 0 * * 0,3' # at midnight UTC every Sunday and Wednesday 15 | jobs: 16 | stale: 17 | runs-on: ubuntu-latest 18 | permissions: 19 | issues: write 20 | pull-requests: write 21 | steps: 22 | - uses: actions/stale@v9 23 | with: 24 | repo-token: ${{ secrets.GITHUB_TOKEN }} 25 | stale-issue-message: > 26 | This issue has been automatically marked as stale because it has not had 27 | recent activity. It will be closed if no further activity occurs. Thank you 28 | for your contributions. 29 | days-before-issue-stale: 150 # marks stale after 5 months 30 | days-before-issue-close: 30 # closes 1 month after being marked with no action 31 | stale-issue-label: "stale" 32 | exempt-issue-labels: "kind/feature,kind/enhancement" 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | /.vscode/ 3 | coverage.out 4 | covdatafiles/ 5 | .DS_Store 6 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Docker Compose V2 2 | Copyright 2020 Docker Compose authors 3 | 4 | This product includes software developed at Docker, Inc. (https://www.docker.com). 5 | -------------------------------------------------------------------------------- /cmd/compose/alpha.go: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright 2020 Docker Compose CLI authors 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | */ 14 | 15 | package compose 16 | 17 | import ( 18 | "github.com/docker/cli/cli/command" 19 | "github.com/docker/compose/v2/pkg/api" 20 | "github.com/spf13/cobra" 21 | ) 22 | 23 | // alphaCommand groups all experimental subcommands 24 | func alphaCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service) *cobra.Command { 25 | cmd := &cobra.Command{ 26 | Short: "Experimental commands", 27 | Use: "alpha [COMMAND]", 28 | Hidden: true, 29 | Annotations: map[string]string{ 30 | "experimentalCLI": "true", 31 | }, 32 | } 33 | cmd.AddCommand( 34 | vizCommand(p, dockerCli, backend), 35 | publishCommand(p, dockerCli, backend), 36 | generateCommand(p, backend), 37 | ) 38 | return cmd 39 | } 40 | -------------------------------------------------------------------------------- /cmd/compose/compose_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package compose 18 | 19 | import ( 20 | "testing" 21 | 22 | "github.com/compose-spec/compose-go/v2/types" 23 | "gotest.tools/v3/assert" 24 | ) 25 | 26 | func TestFilterServices(t *testing.T) { 27 | p := &types.Project{ 28 | Services: types.Services{ 29 | "foo": { 30 | Name: "foo", 31 | Links: []string{"bar"}, 32 | }, 33 | "bar": { 34 | Name: "bar", 35 | DependsOn: map[string]types.ServiceDependency{ 36 | "zot": {}, 37 | }, 38 | }, 39 | "zot": { 40 | Name: "zot", 41 | }, 42 | "qix": { 43 | Name: "qix", 44 | }, 45 | }, 46 | } 47 | p, err := p.WithSelectedServices([]string{"bar"}) 48 | assert.NilError(t, err) 49 | 50 | assert.Equal(t, len(p.Services), 2) 51 | _, err = p.GetService("bar") 52 | assert.NilError(t, err) 53 | _, err = p.GetService("zot") 54 | assert.NilError(t, err) 55 | } 56 | -------------------------------------------------------------------------------- /cmd/compose/up_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package compose 18 | 19 | import ( 20 | "testing" 21 | 22 | "github.com/compose-spec/compose-go/v2/types" 23 | "gotest.tools/v3/assert" 24 | ) 25 | 26 | func TestApplyScaleOpt(t *testing.T) { 27 | p := types.Project{ 28 | Services: types.Services{ 29 | "foo": { 30 | Name: "foo", 31 | }, 32 | "bar": { 33 | Name: "bar", 34 | Deploy: &types.DeployConfig{ 35 | Mode: "test", 36 | }, 37 | }, 38 | }, 39 | } 40 | err := applyScaleOpts(&p, []string{"foo=2", "bar=3"}) 41 | assert.NilError(t, err) 42 | foo, err := p.GetService("foo") 43 | assert.NilError(t, err) 44 | assert.Equal(t, *foo.Scale, 2) 45 | 46 | bar, err := p.GetService("bar") 47 | assert.NilError(t, err) 48 | assert.Equal(t, *bar.Scale, 3) 49 | assert.Equal(t, *bar.Deploy.Replicas, 3) 50 | } 51 | -------------------------------------------------------------------------------- /cmd/formatter/consts.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package formatter 18 | 19 | const ( 20 | // JSON Print in JSON format 21 | JSON = "json" 22 | // TemplateLegacyJSON the legacy json formatting value using go template 23 | TemplateLegacyJSON = "{{json.}}" 24 | // PRETTY is the constant for default formats on list commands 25 | // Deprecated: use TABLE 26 | PRETTY = "pretty" 27 | // TABLE Print output in table format with column headers (default) 28 | TABLE = "table" 29 | ) 30 | -------------------------------------------------------------------------------- /cmd/formatter/json.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package formatter 18 | 19 | import ( 20 | "bytes" 21 | "encoding/json" 22 | ) 23 | 24 | const standardIndentation = " " 25 | 26 | // ToStandardJSON return a string with the JSON representation of the interface{} 27 | func ToStandardJSON(i interface{}) (string, error) { 28 | return ToJSON(i, "", standardIndentation) 29 | } 30 | 31 | // ToJSON return a string with the JSON representation of the interface{} 32 | func ToJSON(i interface{}, prefix string, indentation string) (string, error) { 33 | buffer := &bytes.Buffer{} 34 | encoder := json.NewEncoder(buffer) 35 | encoder.SetEscapeHTML(false) 36 | encoder.SetIndent(prefix, indentation) 37 | err := encoder.Encode(i) 38 | return buffer.String(), err 39 | } 40 | -------------------------------------------------------------------------------- /cmd/formatter/multierrformat.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package formatter 18 | 19 | import ( 20 | "strings" 21 | 22 | "github.com/hashicorp/go-multierror" 23 | ) 24 | 25 | // SetMultiErrorFormat set cli default format for multi-errors 26 | func SetMultiErrorFormat(errs *multierror.Error) { 27 | if errs != nil { 28 | errs.ErrorFormat = formatErrors 29 | } 30 | } 31 | 32 | func formatErrors(errs []error) string { 33 | messages := make([]string, len(errs)) 34 | for i, err := range errs { 35 | messages[i] = "Error: " + err.Error() 36 | } 37 | return strings.Join(messages, "\n") 38 | } 39 | -------------------------------------------------------------------------------- /cmd/formatter/pretty.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package formatter 18 | 19 | import ( 20 | "fmt" 21 | "io" 22 | "strings" 23 | "text/tabwriter" 24 | ) 25 | 26 | // PrintPrettySection prints a tabbed section on the writer parameter 27 | func PrintPrettySection(out io.Writer, printer func(writer io.Writer), headers ...string) error { 28 | w := tabwriter.NewWriter(out, 20, 1, 3, ' ', 0) 29 | _, _ = fmt.Fprintln(w, strings.Join(headers, "\t")) 30 | printer(w) 31 | return w.Flush() 32 | } 33 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | status: 3 | project: 4 | default: 5 | informational: true 6 | target: auto 7 | threshold: 2% 8 | patch: 9 | default: 10 | informational: true 11 | 12 | comment: 13 | require_changes: true 14 | 15 | ignore: 16 | - "packaging" 17 | - "docs" 18 | - "bin" 19 | - "e2e" 20 | - "pkg/e2e" 21 | - "**/*_test.go" 22 | -------------------------------------------------------------------------------- /docs/reference/compose_alpha.md: -------------------------------------------------------------------------------- 1 | # docker compose alpha 2 | 3 | 4 | Experimental commands 5 | 6 | ### Subcommands 7 | 8 | | Name | Description | 9 | |:----------------------------------|:-----------------------------------------------------------------------------------------------------| 10 | | [`viz`](compose_alpha_viz.md) | EXPERIMENTAL - Generate a graphviz graph from your compose file | 11 | | [`watch`](compose_alpha_watch.md) | EXPERIMENTAL - Watch build context for service and rebuild/refresh containers when files are updated | 12 | 13 | 14 | ### Options 15 | 16 | | Name | Type | Default | Description | 17 | |:------------|:-----|:--------|:--------------------------------| 18 | | `--dry-run` | | | Execute command in dry run mode | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/reference/compose_alpha_dry-run.md: -------------------------------------------------------------------------------- 1 | # docker compose alpha dry-run 2 | 3 | 4 | Dry run command allows you to test a command without applying changes 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/reference/compose_alpha_generate.md: -------------------------------------------------------------------------------- 1 | # docker compose alpha generate 2 | 3 | 4 | EXPERIMENTAL - Generate a Compose file from existing containers 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:----------------|:---------|:--------|:------------------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | | `--format` | `string` | `yaml` | Format the output. Values: [yaml \| json] | 12 | | `--name` | `string` | | Project name to set in the Compose file | 13 | | `--project-dir` | `string` | | Directory to use for the project | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/reference/compose_alpha_publish.md: -------------------------------------------------------------------------------- 1 | # docker compose alpha publish 2 | 3 | 4 | Publish compose application 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:--------------------------|:---------|:--------|:-------------------------------------------------------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | | `--oci-version` | `string` | | OCI image/artifact specification version (automatically determined by default) | 12 | | `--resolve-image-digests` | `bool` | | Pin image tags to digests | 13 | | `--with-env` | `bool` | | Include environment variables in the published OCI artifact | 14 | | `-y`, `--yes` | `bool` | | Assume "yes" as answer to all prompts | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/reference/compose_alpha_scale.md: -------------------------------------------------------------------------------- 1 | # docker compose alpha scale 2 | 3 | 4 | Scale services 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:------------|:-----|:--------|:--------------------------------| 10 | | `--dry-run` | | | Execute command in dry run mode | 11 | | `--no-deps` | | | Don't start linked services | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/reference/compose_alpha_viz.md: -------------------------------------------------------------------------------- 1 | # docker compose alpha viz 2 | 3 | 4 | EXPERIMENTAL - Generate a graphviz graph from your compose file 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:---------------------|:-------|:--------|:---------------------------------------------------------------------------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | | `--image` | `bool` | | Include service's image name in output graph | 12 | | `--indentation-size` | `int` | `1` | Number of tabs or spaces to use for indentation | 13 | | `--networks` | `bool` | | Include service's attached networks in output graph | 14 | | `--ports` | `bool` | | Include service's exposed ports in output graph | 15 | | `--spaces` | `bool` | | If given, space character ' ' will be used to indent,
otherwise tab character '\t' will be used | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/reference/compose_alpha_watch.md: -------------------------------------------------------------------------------- 1 | # docker compose alpha watch 2 | 3 | 4 | Watch build context for service and rebuild/refresh containers when files are updated 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:------------|:-----|:--------|:----------------------------------------------| 10 | | `--dry-run` | | | Execute command in dry run mode | 11 | | `--no-up` | | | Do not build & start services before watching | 12 | | `--quiet` | | | hide build output | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/reference/compose_attach.md: -------------------------------------------------------------------------------- 1 | # docker compose attach 2 | 3 | 4 | Attach local standard input, output, and error streams to a service's running container 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:----------------|:---------|:--------|:----------------------------------------------------------| 10 | | `--detach-keys` | `string` | | Override the key sequence for detaching from a container. | 11 | | `--dry-run` | `bool` | | Execute command in dry run mode | 12 | | `--index` | `int` | `0` | index of the container if service has multiple replicas. | 13 | | `--no-stdin` | `bool` | | Do not attach STDIN | 14 | | `--sig-proxy` | `bool` | `true` | Proxy all received signals to the process | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/reference/compose_bridge.md: -------------------------------------------------------------------------------- 1 | # docker compose bridge 2 | 3 | 4 | Convert compose files into another model 5 | 6 | ### Subcommands 7 | 8 | | Name | Description | 9 | |:-------------------------------------------------------|:-----------------------------------------------------------------------------| 10 | | [`convert`](compose_bridge_convert.md) | Convert compose files to Kubernetes manifests, Helm charts, or another model | 11 | | [`transformations`](compose_bridge_transformations.md) | Manage transformation images | 12 | 13 | 14 | ### Options 15 | 16 | | Name | Type | Default | Description | 17 | |:------------|:-------|:--------|:--------------------------------| 18 | | `--dry-run` | `bool` | | Execute command in dry run mode | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/reference/compose_bridge_convert.md: -------------------------------------------------------------------------------- 1 | # docker compose bridge convert 2 | 3 | 4 | Convert compose files to Kubernetes manifests, Helm charts, or another model 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:-------------------------|:--------------|:--------|:-------------------------------------------------------------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | | `-o`, `--output` | `string` | `out` | The output directory for the Kubernetes resources | 12 | | `--templates` | `string` | | Directory containing transformation templates | 13 | | `-t`, `--transformation` | `stringArray` | | Transformation to apply to compose model (default: docker/compose-bridge-kubernetes) | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/reference/compose_bridge_transformations.md: -------------------------------------------------------------------------------- 1 | # docker compose bridge transformations 2 | 3 | 4 | Manage transformation images 5 | 6 | ### Subcommands 7 | 8 | | Name | Description | 9 | |:-----------------------------------------------------|:-------------------------------| 10 | | [`create`](compose_bridge_transformations_create.md) | Create a new transformation | 11 | | [`list`](compose_bridge_transformations_list.md) | List available transformations | 12 | 13 | 14 | ### Options 15 | 16 | | Name | Type | Default | Description | 17 | |:------------|:-------|:--------|:--------------------------------| 18 | | `--dry-run` | `bool` | | Execute command in dry run mode | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/reference/compose_bridge_transformations_create.md: -------------------------------------------------------------------------------- 1 | # docker compose bridge transformations create 2 | 3 | 4 | Create a new transformation 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:---------------|:---------|:--------|:----------------------------------------------------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | | `-f`, `--from` | `string` | | Existing transformation to copy (default: docker/compose-bridge-kubernetes) | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/reference/compose_bridge_transformations_list.md: -------------------------------------------------------------------------------- 1 | # docker compose bridge transformations list 2 | 3 | 4 | List available transformations 5 | 6 | ### Aliases 7 | 8 | `docker compose bridge transformations list`, `docker compose bridge transformations ls` 9 | 10 | ### Options 11 | 12 | | Name | Type | Default | Description | 13 | |:----------------|:---------|:--------|:-------------------------------------------| 14 | | `--dry-run` | `bool` | | Execute command in dry run mode | 15 | | `--format` | `string` | `table` | Format the output. Values: [table \| json] | 16 | | `-q`, `--quiet` | `bool` | | Only display transformer names | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/reference/compose_commit.md: -------------------------------------------------------------------------------- 1 | # docker compose commit 2 | 3 | 4 | Create a new image from a service container's changes 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:------------------|:---------|:--------|:-----------------------------------------------------------| 10 | | `-a`, `--author` | `string` | | Author (e.g., "John Hannibal Smith ") | 11 | | `-c`, `--change` | `list` | | Apply Dockerfile instruction to the created image | 12 | | `--dry-run` | `bool` | | Execute command in dry run mode | 13 | | `--index` | `int` | `0` | index of the container if service has multiple replicas. | 14 | | `-m`, `--message` | `string` | | Commit message | 15 | | `-p`, `--pause` | `bool` | `true` | Pause container during commit | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/reference/compose_cp.md: -------------------------------------------------------------------------------- 1 | # docker compose cp 2 | 3 | 4 | Copy files/folders between a service container and the local filesystem 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:----------------------|:-------|:--------|:--------------------------------------------------------| 10 | | `--all` | `bool` | | Include containers created by the run command | 11 | | `-a`, `--archive` | `bool` | | Archive mode (copy all uid/gid information) | 12 | | `--dry-run` | `bool` | | Execute command in dry run mode | 13 | | `-L`, `--follow-link` | `bool` | | Always follow symbol link in SRC_PATH | 14 | | `--index` | `int` | `0` | Index of the container if service has multiple replicas | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/reference/compose_export.md: -------------------------------------------------------------------------------- 1 | # docker compose export 2 | 3 | 4 | Export a service container's filesystem as a tar archive 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:-----------------|:---------|:--------|:---------------------------------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | | `--index` | `int` | `0` | index of the container if service has multiple replicas. | 12 | | `-o`, `--output` | `string` | | Write to a file, instead of STDOUT | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/reference/compose_images.md: -------------------------------------------------------------------------------- 1 | # docker compose images 2 | 3 | 4 | List images used by the created containers 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:----------------|:---------|:--------|:-------------------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | | `--format` | `string` | `table` | Format the output. Values: [table \| json] | 12 | | `-q`, `--quiet` | `bool` | | Only display IDs | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /docs/reference/compose_kill.md: -------------------------------------------------------------------------------- 1 | # docker compose kill 2 | 3 | 4 | Forces running containers to stop by sending a `SIGKILL` signal. Optionally the signal can be passed, for example: 5 | 6 | ```console 7 | $ docker compose kill -s SIGINT 8 | ``` 9 | 10 | ### Options 11 | 12 | | Name | Type | Default | Description | 13 | |:-------------------|:---------|:----------|:---------------------------------------------------------------| 14 | | `--dry-run` | `bool` | | Execute command in dry run mode | 15 | | `--remove-orphans` | `bool` | | Remove containers for services not defined in the Compose file | 16 | | `-s`, `--signal` | `string` | `SIGKILL` | SIGNAL to send to the container | 17 | 18 | 19 | 20 | 21 | ## Description 22 | 23 | Forces running containers to stop by sending a `SIGKILL` signal. Optionally the signal can be passed, for example: 24 | 25 | ```console 26 | $ docker compose kill -s SIGINT 27 | ``` 28 | -------------------------------------------------------------------------------- /docs/reference/compose_ls.md: -------------------------------------------------------------------------------- 1 | # docker compose ls 2 | 3 | 4 | Lists running Compose projects 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:----------------|:---------|:--------|:-------------------------------------------| 10 | | `-a`, `--all` | `bool` | | Show all stopped Compose projects | 11 | | `--dry-run` | `bool` | | Execute command in dry run mode | 12 | | `--filter` | `filter` | | Filter output based on conditions provided | 13 | | `--format` | `string` | `table` | Format the output. Values: [table \| json] | 14 | | `-q`, `--quiet` | `bool` | | Only display project names | 15 | 16 | 17 | 18 | 19 | ## Description 20 | 21 | Lists running Compose projects 22 | -------------------------------------------------------------------------------- /docs/reference/compose_pause.md: -------------------------------------------------------------------------------- 1 | # docker compose pause 2 | 3 | 4 | Pauses running containers of a service. They can be unpaused with `docker compose unpause`. 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:------------|:-------|:--------|:--------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | 12 | 13 | 14 | 15 | ## Description 16 | 17 | Pauses running containers of a service. They can be unpaused with `docker compose unpause`. -------------------------------------------------------------------------------- /docs/reference/compose_port.md: -------------------------------------------------------------------------------- 1 | # docker compose port 2 | 3 | 4 | Prints the public port for a port binding 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:-------------|:---------|:--------|:--------------------------------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | | `--index` | `int` | `0` | Index of the container if service has multiple replicas | 12 | | `--protocol` | `string` | `tcp` | tcp or udp | 13 | 14 | 15 | 16 | 17 | ## Description 18 | 19 | Prints the public port for a port binding 20 | -------------------------------------------------------------------------------- /docs/reference/compose_publish.md: -------------------------------------------------------------------------------- 1 | # docker compose publish 2 | 3 | 4 | Publish compose application 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:--------------------------|:---------|:--------|:-------------------------------------------------------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | | `--oci-version` | `string` | | OCI image/artifact specification version (automatically determined by default) | 12 | | `--resolve-image-digests` | `bool` | | Pin image tags to digests | 13 | | `--with-env` | `bool` | | Include environment variables in the published OCI artifact | 14 | | `-y`, `--yes` | `bool` | | Assume "yes" as answer to all prompts | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/reference/compose_scale.md: -------------------------------------------------------------------------------- 1 | # docker compose scale 2 | 3 | 4 | Scale services 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:------------|:-------|:--------|:--------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | | `--no-deps` | `bool` | | Don't start linked services | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/reference/compose_start.md: -------------------------------------------------------------------------------- 1 | # docker compose start 2 | 3 | 4 | Starts existing containers for a service 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:------------|:-------|:--------|:--------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | 12 | 13 | 14 | 15 | ## Description 16 | 17 | Starts existing containers for a service 18 | -------------------------------------------------------------------------------- /docs/reference/compose_stop.md: -------------------------------------------------------------------------------- 1 | # docker compose stop 2 | 3 | 4 | Stops running containers without removing them. They can be started again with `docker compose start`. 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:------------------|:-------|:--------|:--------------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | | `-t`, `--timeout` | `int` | `0` | Specify a shutdown timeout in seconds | 12 | 13 | 14 | 15 | 16 | ## Description 17 | 18 | Stops running containers without removing them. They can be started again with `docker compose start`. 19 | -------------------------------------------------------------------------------- /docs/reference/compose_top.md: -------------------------------------------------------------------------------- 1 | # docker compose top 2 | 3 | 4 | Displays the running processes 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:------------|:-------|:--------|:--------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | 12 | 13 | 14 | 15 | ## Description 16 | 17 | Displays the running processes 18 | 19 | ## Examples 20 | 21 | ```console 22 | $ docker compose top 23 | example_foo_1 24 | UID PID PPID C STIME TTY TIME CMD 25 | root 142353 142331 2 15:33 ? 00:00:00 ping localhost -c 5 26 | ``` 27 | -------------------------------------------------------------------------------- /docs/reference/compose_unpause.md: -------------------------------------------------------------------------------- 1 | # docker compose unpause 2 | 3 | 4 | Unpauses paused containers of a service 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:------------|:-------|:--------|:--------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | 12 | 13 | 14 | 15 | ## Description 16 | 17 | Unpauses paused containers of a service 18 | -------------------------------------------------------------------------------- /docs/reference/compose_version.md: -------------------------------------------------------------------------------- 1 | # docker compose version 2 | 3 | 4 | Show the Docker Compose version information 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:-----------------|:---------|:--------|:---------------------------------------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | | `-f`, `--format` | `string` | | Format the output. Values: [pretty \| json]. (Default: pretty) | 12 | | `--short` | `bool` | | Shows only Compose's version number | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/reference/compose_wait.md: -------------------------------------------------------------------------------- 1 | # docker compose wait 2 | 3 | 4 | Block until containers of all (or specified) services stop. 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:-----------------|:-------|:--------|:---------------------------------------------| 10 | | `--down-project` | `bool` | | Drops project when the first container stops | 11 | | `--dry-run` | `bool` | | Execute command in dry run mode | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/reference/compose_watch.md: -------------------------------------------------------------------------------- 1 | # docker compose watch 2 | 3 | 4 | Watch build context for service and rebuild/refresh containers when files are updated 5 | 6 | ### Options 7 | 8 | | Name | Type | Default | Description | 9 | |:------------|:-------|:--------|:----------------------------------------------| 10 | | `--dry-run` | `bool` | | Execute command in dry run mode | 11 | | `--no-up` | `bool` | | Do not build & start services before watching | 12 | | `--prune` | `bool` | `true` | Prune dangling images on rebuild | 13 | | `--quiet` | `bool` | | hide build output | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_alpha.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose alpha 2 | short: Experimental commands 3 | long: Experimental commands 4 | pname: docker compose 5 | plink: docker_compose.yaml 6 | cname: 7 | - docker compose alpha generate 8 | - docker compose alpha publish 9 | - docker compose alpha viz 10 | clink: 11 | - docker_compose_alpha_generate.yaml 12 | - docker_compose_alpha_publish.yaml 13 | - docker_compose_alpha_viz.yaml 14 | inherited_options: 15 | - option: dry-run 16 | value_type: bool 17 | default_value: "false" 18 | description: Execute command in dry run mode 19 | deprecated: false 20 | hidden: false 21 | experimental: false 22 | experimentalcli: false 23 | kubernetes: false 24 | swarm: false 25 | deprecated: false 26 | hidden: true 27 | experimental: false 28 | experimentalcli: true 29 | kubernetes: false 30 | swarm: false 31 | 32 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_alpha_dry-run.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose alpha dry-run 2 | short: | 3 | EXPERIMENTAL - Dry run command allow you to test a command without applying changes 4 | long: | 5 | EXPERIMENTAL - Dry run command allow you to test a command without applying changes 6 | usage: docker compose alpha dry-run -- [COMMAND...] 7 | pname: docker compose alpha 8 | plink: docker_compose_alpha.yaml 9 | deprecated: false 10 | experimental: false 11 | experimentalcli: true 12 | kubernetes: false 13 | swarm: false 14 | 15 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_alpha_scale.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose alpha scale 2 | short: Scale services 3 | long: Scale services 4 | usage: docker compose alpha scale [SERVICE=REPLICAS...] 5 | pname: docker compose alpha 6 | plink: docker_compose_alpha.yaml 7 | options: 8 | - option: no-deps 9 | value_type: bool 10 | default_value: "false" 11 | description: Don't start linked services. 12 | deprecated: false 13 | hidden: false 14 | experimental: false 15 | experimentalcli: false 16 | kubernetes: false 17 | swarm: false 18 | inherited_options: 19 | - option: dry-run 20 | value_type: bool 21 | default_value: "false" 22 | description: Execute command in dry run mode 23 | deprecated: false 24 | hidden: false 25 | experimental: false 26 | experimentalcli: false 27 | kubernetes: false 28 | swarm: false 29 | deprecated: false 30 | hidden: false 31 | experimental: false 32 | experimentalcli: true 33 | kubernetes: false 34 | swarm: false 35 | 36 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_alpha_watch.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose alpha watch 2 | short: | 3 | Watch build context for service and rebuild/refresh containers when files are updated 4 | long: | 5 | Watch build context for service and rebuild/refresh containers when files are updated 6 | usage: docker compose alpha watch [SERVICE...] 7 | pname: docker compose alpha 8 | plink: docker_compose_alpha.yaml 9 | options: 10 | - option: no-up 11 | value_type: bool 12 | default_value: "false" 13 | description: Do not build & start services before watching 14 | deprecated: false 15 | hidden: false 16 | experimental: false 17 | experimentalcli: false 18 | kubernetes: false 19 | swarm: false 20 | - option: quiet 21 | value_type: bool 22 | default_value: "false" 23 | description: hide build output 24 | deprecated: false 25 | hidden: false 26 | experimental: false 27 | experimentalcli: false 28 | kubernetes: false 29 | swarm: false 30 | inherited_options: 31 | - option: dry-run 32 | value_type: bool 33 | default_value: "false" 34 | description: Execute command in dry run mode 35 | deprecated: false 36 | hidden: false 37 | experimental: false 38 | experimentalcli: false 39 | kubernetes: false 40 | swarm: false 41 | deprecated: false 42 | hidden: false 43 | experimental: false 44 | experimentalcli: true 45 | kubernetes: false 46 | swarm: false 47 | 48 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_bridge.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose bridge 2 | short: Convert compose files into another model 3 | long: Convert compose files into another model 4 | pname: docker compose 5 | plink: docker_compose.yaml 6 | cname: 7 | - docker compose bridge convert 8 | - docker compose bridge transformations 9 | clink: 10 | - docker_compose_bridge_convert.yaml 11 | - docker_compose_bridge_transformations.yaml 12 | inherited_options: 13 | - option: dry-run 14 | value_type: bool 15 | default_value: "false" 16 | description: Execute command in dry run mode 17 | deprecated: false 18 | hidden: false 19 | experimental: false 20 | experimentalcli: false 21 | kubernetes: false 22 | swarm: false 23 | deprecated: false 24 | hidden: false 25 | experimental: false 26 | experimentalcli: false 27 | kubernetes: false 28 | swarm: false 29 | 30 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_bridge_transformations.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose bridge transformations 2 | short: Manage transformation images 3 | long: Manage transformation images 4 | pname: docker compose bridge 5 | plink: docker_compose_bridge.yaml 6 | cname: 7 | - docker compose bridge transformations create 8 | - docker compose bridge transformations list 9 | clink: 10 | - docker_compose_bridge_transformations_create.yaml 11 | - docker_compose_bridge_transformations_list.yaml 12 | inherited_options: 13 | - option: dry-run 14 | value_type: bool 15 | default_value: "false" 16 | description: Execute command in dry run mode 17 | deprecated: false 18 | hidden: false 19 | experimental: false 20 | experimentalcli: false 21 | kubernetes: false 22 | swarm: false 23 | deprecated: false 24 | hidden: false 25 | experimental: false 26 | experimentalcli: false 27 | kubernetes: false 28 | swarm: false 29 | 30 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_bridge_transformations_create.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose bridge transformations create 2 | short: Create a new transformation 3 | long: Create a new transformation 4 | usage: docker compose bridge transformations create [OPTION] PATH 5 | pname: docker compose bridge transformations 6 | plink: docker_compose_bridge_transformations.yaml 7 | options: 8 | - option: from 9 | shorthand: f 10 | value_type: string 11 | description: | 12 | Existing transformation to copy (default: docker/compose-bridge-kubernetes) 13 | deprecated: false 14 | hidden: false 15 | experimental: false 16 | experimentalcli: false 17 | kubernetes: false 18 | swarm: false 19 | inherited_options: 20 | - option: dry-run 21 | value_type: bool 22 | default_value: "false" 23 | description: Execute command in dry run mode 24 | deprecated: false 25 | hidden: false 26 | experimental: false 27 | experimentalcli: false 28 | kubernetes: false 29 | swarm: false 30 | deprecated: false 31 | hidden: false 32 | experimental: false 33 | experimentalcli: false 34 | kubernetes: false 35 | swarm: false 36 | 37 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_bridge_transformations_list.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose bridge transformations list 2 | aliases: docker compose bridge transformations list, docker compose bridge transformations ls 3 | short: List available transformations 4 | long: List available transformations 5 | usage: docker compose bridge transformations list 6 | pname: docker compose bridge transformations 7 | plink: docker_compose_bridge_transformations.yaml 8 | options: 9 | - option: format 10 | value_type: string 11 | default_value: table 12 | description: 'Format the output. Values: [table | json]' 13 | deprecated: false 14 | hidden: false 15 | experimental: false 16 | experimentalcli: false 17 | kubernetes: false 18 | swarm: false 19 | - option: quiet 20 | shorthand: q 21 | value_type: bool 22 | default_value: "false" 23 | description: Only display transformer names 24 | deprecated: false 25 | hidden: false 26 | experimental: false 27 | experimentalcli: false 28 | kubernetes: false 29 | swarm: false 30 | inherited_options: 31 | - option: dry-run 32 | value_type: bool 33 | default_value: "false" 34 | description: Execute command in dry run mode 35 | deprecated: false 36 | hidden: false 37 | experimental: false 38 | experimentalcli: false 39 | kubernetes: false 40 | swarm: false 41 | deprecated: false 42 | hidden: false 43 | experimental: false 44 | experimentalcli: false 45 | kubernetes: false 46 | swarm: false 47 | 48 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_export.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose export 2 | short: Export a service container's filesystem as a tar archive 3 | long: Export a service container's filesystem as a tar archive 4 | usage: docker compose export [OPTIONS] SERVICE 5 | pname: docker compose 6 | plink: docker_compose.yaml 7 | options: 8 | - option: index 9 | value_type: int 10 | default_value: "0" 11 | description: index of the container if service has multiple replicas. 12 | deprecated: false 13 | hidden: false 14 | experimental: false 15 | experimentalcli: false 16 | kubernetes: false 17 | swarm: false 18 | - option: output 19 | shorthand: o 20 | value_type: string 21 | description: Write to a file, instead of STDOUT 22 | deprecated: false 23 | hidden: false 24 | experimental: false 25 | experimentalcli: false 26 | kubernetes: false 27 | swarm: false 28 | inherited_options: 29 | - option: dry-run 30 | value_type: bool 31 | default_value: "false" 32 | description: Execute command in dry run mode 33 | deprecated: false 34 | hidden: false 35 | experimental: false 36 | experimentalcli: false 37 | kubernetes: false 38 | swarm: false 39 | deprecated: false 40 | hidden: false 41 | experimental: false 42 | experimentalcli: false 43 | kubernetes: false 44 | swarm: false 45 | 46 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_images.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose images 2 | short: List images used by the created containers 3 | long: List images used by the created containers 4 | usage: docker compose images [OPTIONS] [SERVICE...] 5 | pname: docker compose 6 | plink: docker_compose.yaml 7 | options: 8 | - option: format 9 | value_type: string 10 | default_value: table 11 | description: 'Format the output. Values: [table | json]' 12 | deprecated: false 13 | hidden: false 14 | experimental: false 15 | experimentalcli: false 16 | kubernetes: false 17 | swarm: false 18 | - option: quiet 19 | shorthand: q 20 | value_type: bool 21 | default_value: "false" 22 | description: Only display IDs 23 | deprecated: false 24 | hidden: false 25 | experimental: false 26 | experimentalcli: false 27 | kubernetes: false 28 | swarm: false 29 | inherited_options: 30 | - option: dry-run 31 | value_type: bool 32 | default_value: "false" 33 | description: Execute command in dry run mode 34 | deprecated: false 35 | hidden: false 36 | experimental: false 37 | experimentalcli: false 38 | kubernetes: false 39 | swarm: false 40 | deprecated: false 41 | hidden: false 42 | experimental: false 43 | experimentalcli: false 44 | kubernetes: false 45 | swarm: false 46 | 47 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_kill.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose kill 2 | short: Force stop service containers 3 | long: |- 4 | Forces running containers to stop by sending a `SIGKILL` signal. Optionally the signal can be passed, for example: 5 | 6 | ```console 7 | $ docker compose kill -s SIGINT 8 | ``` 9 | usage: docker compose kill [OPTIONS] [SERVICE...] 10 | pname: docker compose 11 | plink: docker_compose.yaml 12 | options: 13 | - option: remove-orphans 14 | value_type: bool 15 | default_value: "false" 16 | description: Remove containers for services not defined in the Compose file 17 | deprecated: false 18 | hidden: false 19 | experimental: false 20 | experimentalcli: false 21 | kubernetes: false 22 | swarm: false 23 | - option: signal 24 | shorthand: s 25 | value_type: string 26 | default_value: SIGKILL 27 | description: SIGNAL to send to the container 28 | deprecated: false 29 | hidden: false 30 | experimental: false 31 | experimentalcli: false 32 | kubernetes: false 33 | swarm: false 34 | inherited_options: 35 | - option: dry-run 36 | value_type: bool 37 | default_value: "false" 38 | description: Execute command in dry run mode 39 | deprecated: false 40 | hidden: false 41 | experimental: false 42 | experimentalcli: false 43 | kubernetes: false 44 | swarm: false 45 | deprecated: false 46 | hidden: false 47 | experimental: false 48 | experimentalcli: false 49 | kubernetes: false 50 | swarm: false 51 | 52 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_pause.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose pause 2 | short: Pause services 3 | long: | 4 | Pauses running containers of a service. They can be unpaused with `docker compose unpause`. 5 | usage: docker compose pause [SERVICE...] 6 | pname: docker compose 7 | plink: docker_compose.yaml 8 | inherited_options: 9 | - option: dry-run 10 | value_type: bool 11 | default_value: "false" 12 | description: Execute command in dry run mode 13 | deprecated: false 14 | hidden: false 15 | experimental: false 16 | experimentalcli: false 17 | kubernetes: false 18 | swarm: false 19 | deprecated: false 20 | hidden: false 21 | experimental: false 22 | experimentalcli: false 23 | kubernetes: false 24 | swarm: false 25 | 26 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_port.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose port 2 | short: Print the public port for a port binding 3 | long: Prints the public port for a port binding 4 | usage: docker compose port [OPTIONS] SERVICE PRIVATE_PORT 5 | pname: docker compose 6 | plink: docker_compose.yaml 7 | options: 8 | - option: index 9 | value_type: int 10 | default_value: "0" 11 | description: Index of the container if service has multiple replicas 12 | deprecated: false 13 | hidden: false 14 | experimental: false 15 | experimentalcli: false 16 | kubernetes: false 17 | swarm: false 18 | - option: protocol 19 | value_type: string 20 | default_value: tcp 21 | description: tcp or udp 22 | deprecated: false 23 | hidden: false 24 | experimental: false 25 | experimentalcli: false 26 | kubernetes: false 27 | swarm: false 28 | inherited_options: 29 | - option: dry-run 30 | value_type: bool 31 | default_value: "false" 32 | description: Execute command in dry run mode 33 | deprecated: false 34 | hidden: false 35 | experimental: false 36 | experimentalcli: false 37 | kubernetes: false 38 | swarm: false 39 | deprecated: false 40 | hidden: false 41 | experimental: false 42 | experimentalcli: false 43 | kubernetes: false 44 | swarm: false 45 | 46 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_scale.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose scale 2 | short: Scale services 3 | long: Scale services 4 | usage: docker compose scale [SERVICE=REPLICAS...] 5 | pname: docker compose 6 | plink: docker_compose.yaml 7 | options: 8 | - option: no-deps 9 | value_type: bool 10 | default_value: "false" 11 | description: Don't start linked services 12 | deprecated: false 13 | hidden: false 14 | experimental: false 15 | experimentalcli: false 16 | kubernetes: false 17 | swarm: false 18 | inherited_options: 19 | - option: dry-run 20 | value_type: bool 21 | default_value: "false" 22 | description: Execute command in dry run mode 23 | deprecated: false 24 | hidden: false 25 | experimental: false 26 | experimentalcli: false 27 | kubernetes: false 28 | swarm: false 29 | deprecated: false 30 | hidden: false 31 | experimental: false 32 | experimentalcli: false 33 | kubernetes: false 34 | swarm: false 35 | 36 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_start.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose start 2 | short: Start services 3 | long: Starts existing containers for a service 4 | usage: docker compose start [SERVICE...] 5 | pname: docker compose 6 | plink: docker_compose.yaml 7 | inherited_options: 8 | - option: dry-run 9 | value_type: bool 10 | default_value: "false" 11 | description: Execute command in dry run mode 12 | deprecated: false 13 | hidden: false 14 | experimental: false 15 | experimentalcli: false 16 | kubernetes: false 17 | swarm: false 18 | deprecated: false 19 | hidden: false 20 | experimental: false 21 | experimentalcli: false 22 | kubernetes: false 23 | swarm: false 24 | 25 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_stop.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose stop 2 | short: Stop services 3 | long: | 4 | Stops running containers without removing them. They can be started again with `docker compose start`. 5 | usage: docker compose stop [OPTIONS] [SERVICE...] 6 | pname: docker compose 7 | plink: docker_compose.yaml 8 | options: 9 | - option: timeout 10 | shorthand: t 11 | value_type: int 12 | default_value: "0" 13 | description: Specify a shutdown timeout in seconds 14 | deprecated: false 15 | hidden: false 16 | experimental: false 17 | experimentalcli: false 18 | kubernetes: false 19 | swarm: false 20 | inherited_options: 21 | - option: dry-run 22 | value_type: bool 23 | default_value: "false" 24 | description: Execute command in dry run mode 25 | deprecated: false 26 | hidden: false 27 | experimental: false 28 | experimentalcli: false 29 | kubernetes: false 30 | swarm: false 31 | deprecated: false 32 | hidden: false 33 | experimental: false 34 | experimentalcli: false 35 | kubernetes: false 36 | swarm: false 37 | 38 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_top.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose top 2 | short: Display the running processes 3 | long: Displays the running processes 4 | usage: docker compose top [SERVICES...] 5 | pname: docker compose 6 | plink: docker_compose.yaml 7 | inherited_options: 8 | - option: dry-run 9 | value_type: bool 10 | default_value: "false" 11 | description: Execute command in dry run mode 12 | deprecated: false 13 | hidden: false 14 | experimental: false 15 | experimentalcli: false 16 | kubernetes: false 17 | swarm: false 18 | examples: |- 19 | ```console 20 | $ docker compose top 21 | example_foo_1 22 | UID PID PPID C STIME TTY TIME CMD 23 | root 142353 142331 2 15:33 ? 00:00:00 ping localhost -c 5 24 | ``` 25 | deprecated: false 26 | hidden: false 27 | experimental: false 28 | experimentalcli: false 29 | kubernetes: false 30 | swarm: false 31 | 32 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_unpause.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose unpause 2 | short: Unpause services 3 | long: Unpauses paused containers of a service 4 | usage: docker compose unpause [SERVICE...] 5 | pname: docker compose 6 | plink: docker_compose.yaml 7 | inherited_options: 8 | - option: dry-run 9 | value_type: bool 10 | default_value: "false" 11 | description: Execute command in dry run mode 12 | deprecated: false 13 | hidden: false 14 | experimental: false 15 | experimentalcli: false 16 | kubernetes: false 17 | swarm: false 18 | deprecated: false 19 | hidden: false 20 | experimental: false 21 | experimentalcli: false 22 | kubernetes: false 23 | swarm: false 24 | 25 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_version.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose version 2 | short: Show the Docker Compose version information 3 | long: Show the Docker Compose version information 4 | usage: docker compose version [OPTIONS] 5 | pname: docker compose 6 | plink: docker_compose.yaml 7 | options: 8 | - option: format 9 | shorthand: f 10 | value_type: string 11 | description: 'Format the output. Values: [pretty | json]. (Default: pretty)' 12 | deprecated: false 13 | hidden: false 14 | experimental: false 15 | experimentalcli: false 16 | kubernetes: false 17 | swarm: false 18 | - option: short 19 | value_type: bool 20 | default_value: "false" 21 | description: Shows only Compose's version number 22 | deprecated: false 23 | hidden: false 24 | experimental: false 25 | experimentalcli: false 26 | kubernetes: false 27 | swarm: false 28 | inherited_options: 29 | - option: dry-run 30 | value_type: bool 31 | default_value: "false" 32 | description: Execute command in dry run mode 33 | deprecated: false 34 | hidden: false 35 | experimental: false 36 | experimentalcli: false 37 | kubernetes: false 38 | swarm: false 39 | deprecated: false 40 | hidden: false 41 | experimental: false 42 | experimentalcli: false 43 | kubernetes: false 44 | swarm: false 45 | 46 | -------------------------------------------------------------------------------- /docs/reference/docker_compose_wait.yaml: -------------------------------------------------------------------------------- 1 | command: docker compose wait 2 | short: Block until containers of all (or specified) services stop. 3 | long: Block until containers of all (or specified) services stop. 4 | usage: docker compose wait SERVICE [SERVICE...] [OPTIONS] 5 | pname: docker compose 6 | plink: docker_compose.yaml 7 | options: 8 | - option: down-project 9 | value_type: bool 10 | default_value: "false" 11 | description: Drops project when the first container stops 12 | deprecated: false 13 | hidden: false 14 | experimental: false 15 | experimentalcli: false 16 | kubernetes: false 17 | swarm: false 18 | inherited_options: 19 | - option: dry-run 20 | value_type: bool 21 | default_value: "false" 22 | description: Execute command in dry run mode 23 | deprecated: false 24 | hidden: false 25 | experimental: false 26 | experimentalcli: false 27 | kubernetes: false 28 | swarm: false 29 | deprecated: false 30 | hidden: false 31 | experimental: false 32 | experimentalcli: false 33 | kubernetes: false 34 | swarm: false 35 | 36 | -------------------------------------------------------------------------------- /internal/desktop/client_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package desktop 18 | 19 | import ( 20 | "context" 21 | "os" 22 | "testing" 23 | "time" 24 | 25 | "github.com/stretchr/testify/require" 26 | ) 27 | 28 | func TestClientPing(t *testing.T) { 29 | if testing.Short() { 30 | t.Skip("Skipped in short mode - test connects to Docker Desktop") 31 | } 32 | desktopEndpoint := os.Getenv("COMPOSE_TEST_DESKTOP_ENDPOINT") 33 | if desktopEndpoint == "" { 34 | t.Skip("Skipping - COMPOSE_TEST_DESKTOP_ENDPOINT not defined") 35 | } 36 | 37 | ctx, cancel := context.WithCancel(context.Background()) 38 | t.Cleanup(cancel) 39 | 40 | client := NewClient(desktopEndpoint) 41 | t.Cleanup(func() { 42 | _ = client.Close() 43 | }) 44 | 45 | now := time.Now() 46 | 47 | ret, err := client.Ping(ctx) 48 | require.NoError(t, err) 49 | 50 | serverTime := time.Unix(0, ret.ServerTime) 51 | require.True(t, now.Before(serverTime)) 52 | } 53 | -------------------------------------------------------------------------------- /internal/locker/pidfile.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package locker 18 | 19 | import ( 20 | "fmt" 21 | "path/filepath" 22 | ) 23 | 24 | type Pidfile struct { 25 | path string 26 | } 27 | 28 | func NewPidfile(projectName string) (*Pidfile, error) { 29 | run, err := runDir() 30 | if err != nil { 31 | return nil, err 32 | } 33 | path := filepath.Join(run, fmt.Sprintf("%s.pid", projectName)) 34 | return &Pidfile{path: path}, nil 35 | } 36 | -------------------------------------------------------------------------------- /internal/locker/pidfile_unix.go: -------------------------------------------------------------------------------- 1 | //go:build !windows 2 | 3 | /* 4 | Copyright 2023 Docker Compose CLI authors 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package locker 20 | 21 | import ( 22 | "os" 23 | 24 | "github.com/docker/docker/pkg/pidfile" 25 | ) 26 | 27 | func (f *Pidfile) Lock() error { 28 | return pidfile.Write(f.path, os.Getpid()) 29 | } 30 | -------------------------------------------------------------------------------- /internal/locker/runtime.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package locker 18 | 19 | import ( 20 | "os" 21 | ) 22 | 23 | func runDir() (string, error) { 24 | run, ok := os.LookupEnv("XDG_RUNTIME_DIR") 25 | if ok { 26 | return run, nil 27 | } 28 | 29 | path, err := osDependentRunDir() 30 | if err != nil { 31 | return "", err 32 | } 33 | err = os.MkdirAll(path, 0o700) 34 | return path, err 35 | } 36 | -------------------------------------------------------------------------------- /internal/locker/runtime_darwin.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package locker 18 | 19 | import ( 20 | "os" 21 | "path/filepath" 22 | ) 23 | 24 | // Based on https://github.com/adrg/xdg 25 | // Licensed under MIT License (MIT) 26 | // Copyright (c) 2014 Adrian-George Bostan 27 | 28 | func osDependentRunDir() (string, error) { 29 | home, err := os.UserHomeDir() 30 | if err != nil { 31 | return "", err 32 | } 33 | return filepath.Join(home, "Library", "Application Support", "com.docker.compose"), nil 34 | } 35 | -------------------------------------------------------------------------------- /internal/locker/runtime_unix.go: -------------------------------------------------------------------------------- 1 | //go:build linux || openbsd 2 | 3 | /* 4 | Copyright 2020 Docker Compose CLI authors 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package locker 20 | 21 | import ( 22 | "os" 23 | "path/filepath" 24 | "strconv" 25 | ) 26 | 27 | // Based on https://github.com/adrg/xdg 28 | // Licensed under MIT License (MIT) 29 | // Copyright (c) 2014 Adrian-George Bostan 30 | 31 | func osDependentRunDir() (string, error) { 32 | run := filepath.Join("run", "user", strconv.Itoa(os.Getuid())) 33 | if _, err := os.Stat(run); err == nil { 34 | return run, nil 35 | } 36 | 37 | // /run/user/$uid is set by pam_systemd, but might not be present, especially in containerized environments 38 | home, err := os.UserHomeDir() 39 | if err != nil { 40 | return "", err 41 | } 42 | return filepath.Join(home, ".docker", "docker-compose"), nil 43 | } 44 | -------------------------------------------------------------------------------- /internal/memnet/conn_unix.go: -------------------------------------------------------------------------------- 1 | //go:build !windows 2 | 3 | /* 4 | Copyright 2023 Docker Compose CLI authors 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package memnet 20 | 21 | import ( 22 | "context" 23 | "fmt" 24 | "net" 25 | "syscall" 26 | ) 27 | 28 | const maxUnixSocketPathSize = len(syscall.RawSockaddrUnix{}.Path) 29 | 30 | func dialNamedPipe(_ context.Context, _ string) (net.Conn, error) { 31 | return nil, fmt.Errorf("named pipes are only available on Windows") 32 | } 33 | 34 | func validateSocketPath(addr string) error { 35 | if len(addr) > maxUnixSocketPathSize { 36 | return fmt.Errorf("socket address is too long: %s", addr) 37 | } 38 | return nil 39 | } 40 | -------------------------------------------------------------------------------- /internal/memnet/conn_windows.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package memnet 18 | 19 | import ( 20 | "context" 21 | "net" 22 | 23 | "github.com/Microsoft/go-winio" 24 | ) 25 | 26 | func dialNamedPipe(ctx context.Context, addr string) (net.Conn, error) { 27 | return winio.DialPipeContext(ctx, addr) 28 | } 29 | 30 | func validateSocketPath(addr string) error { 31 | // AF_UNIX sockets do not have strict path limits on Windows 32 | return nil 33 | } 34 | -------------------------------------------------------------------------------- /internal/sync/shared.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | */ 14 | 15 | package sync 16 | 17 | import ( 18 | "context" 19 | ) 20 | 21 | // PathMapping contains the Compose service and modified host system path. 22 | type PathMapping struct { 23 | // HostPath that was created/modified/deleted outside the container. 24 | // 25 | // This is the path as seen from the user's perspective, e.g. 26 | // - C:\Users\moby\Documents\hello-world\main.go (file on Windows) 27 | // - /Users/moby/Documents/hello-world (directory on macOS) 28 | HostPath string 29 | // ContainerPath for the target file inside the container (only populated 30 | // for sync events, not rebuild). 31 | // 32 | // This is the path as used in Docker CLI commands, e.g. 33 | // - /workdir/main.go 34 | // - /workdir/subdir 35 | ContainerPath string 36 | } 37 | 38 | type Syncer interface { 39 | Sync(ctx context.Context, service string, paths []*PathMapping) error 40 | } 41 | -------------------------------------------------------------------------------- /internal/tracing/errors.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package tracing 18 | 19 | import ( 20 | "go.opentelemetry.io/otel" 21 | ) 22 | 23 | // skipErrors is a no-op otel.ErrorHandler. 24 | type skipErrors struct{} 25 | 26 | // Handle does nothing, ignoring any errors passed to it. 27 | func (skipErrors) Handle(_ error) {} 28 | 29 | var _ otel.ErrorHandler = skipErrors{} 30 | -------------------------------------------------------------------------------- /internal/tracing/keyboard_metrics.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package tracing 18 | 19 | import ( 20 | "context" 21 | 22 | "go.opentelemetry.io/otel/attribute" 23 | ) 24 | 25 | func KeyboardMetrics(ctx context.Context, enabled, isDockerDesktopActive, isWatchConfigured bool) { 26 | commandAvailable := []string{} 27 | if isDockerDesktopActive { 28 | commandAvailable = append(commandAvailable, "gui") 29 | commandAvailable = append(commandAvailable, "gui/composeview") 30 | } 31 | if isWatchConfigured { 32 | commandAvailable = append(commandAvailable, "watch") 33 | } 34 | 35 | AddAttributeToSpan(ctx, 36 | attribute.Bool("navmenu.enabled", enabled), 37 | attribute.StringSlice("navmenu.command_available", commandAvailable)) 38 | } 39 | -------------------------------------------------------------------------------- /internal/tracing/mux.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package tracing 18 | 19 | import ( 20 | "context" 21 | 22 | "github.com/hashicorp/go-multierror" 23 | sdktrace "go.opentelemetry.io/otel/sdk/trace" 24 | ) 25 | 26 | type MuxExporter struct { 27 | exporters []sdktrace.SpanExporter 28 | } 29 | 30 | func (m MuxExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error { 31 | var eg multierror.Group 32 | for i := range m.exporters { 33 | exporter := m.exporters[i] 34 | eg.Go(func() error { 35 | return exporter.ExportSpans(ctx, spans) 36 | }) 37 | } 38 | return eg.Wait() 39 | } 40 | 41 | func (m MuxExporter) Shutdown(ctx context.Context) error { 42 | var eg multierror.Group 43 | for i := range m.exporters { 44 | exporter := m.exporters[i] 45 | eg.Go(func() error { 46 | return exporter.Shutdown(ctx) 47 | }) 48 | } 49 | return eg.Wait() 50 | } 51 | -------------------------------------------------------------------------------- /internal/variables.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package internal 18 | 19 | // Version is the version of the CLI injected in compilation time 20 | var Version = "dev" 21 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docker/compose/f4fc010d6b9bbd40e0ab6e3706a49ee459a2d181/logo.png -------------------------------------------------------------------------------- /pkg/api/api_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package api 18 | 19 | import ( 20 | "testing" 21 | 22 | "github.com/compose-spec/compose-go/v2/types" 23 | "gotest.tools/v3/assert" 24 | ) 25 | 26 | func TestRunOptionsEnvironmentMap(t *testing.T) { 27 | opts := RunOptions{ 28 | Environment: []string{ 29 | "FOO=BAR", 30 | "ZOT=", 31 | "QIX", 32 | }, 33 | } 34 | env := types.NewMappingWithEquals(opts.Environment) 35 | assert.Equal(t, *env["FOO"], "BAR") 36 | assert.Equal(t, *env["ZOT"], "") 37 | assert.Check(t, env["QIX"] == nil) 38 | } 39 | -------------------------------------------------------------------------------- /pkg/api/io.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package api 18 | 19 | import ( 20 | "github.com/docker/cli/cli/streams" 21 | ) 22 | 23 | type Streams interface { 24 | Out() *streams.Out 25 | Err() *streams.Out 26 | In() *streams.In 27 | } 28 | -------------------------------------------------------------------------------- /pkg/compose/attach_service.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package compose 18 | 19 | import ( 20 | "context" 21 | "strings" 22 | 23 | "github.com/docker/cli/cli/command/container" 24 | "github.com/docker/compose/v2/pkg/api" 25 | ) 26 | 27 | func (s *composeService) Attach(ctx context.Context, projectName string, options api.AttachOptions) error { 28 | projectName = strings.ToLower(projectName) 29 | target, err := s.getSpecifiedContainer(ctx, projectName, oneOffInclude, false, options.Service, options.Index) 30 | if err != nil { 31 | return err 32 | } 33 | 34 | var attach container.AttachOptions 35 | attach.DetachKeys = options.DetachKeys 36 | attach.NoStdin = options.NoStdin 37 | attach.Proxy = options.Proxy 38 | return container.RunAttach(ctx, s.dockerCli, target.ID, &attach) 39 | } 40 | -------------------------------------------------------------------------------- /pkg/compose/desktop.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2024 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package compose 18 | 19 | import ( 20 | "github.com/docker/compose/v2/internal/desktop" 21 | "github.com/docker/compose/v2/internal/experimental" 22 | ) 23 | 24 | func (s *composeService) SetDesktopClient(cli *desktop.Client) { 25 | s.desktopCli = cli 26 | } 27 | 28 | func (s *composeService) SetExperiments(experiments *experimental.State) { 29 | s.experiments = experiments 30 | } 31 | -------------------------------------------------------------------------------- /pkg/compose/hash_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package compose 18 | 19 | import ( 20 | "testing" 21 | 22 | "github.com/compose-spec/compose-go/v2/types" 23 | "gotest.tools/v3/assert" 24 | ) 25 | 26 | func TestServiceHash(t *testing.T) { 27 | hash1, err := ServiceHash(serviceConfig(1)) 28 | assert.NilError(t, err) 29 | hash2, err := ServiceHash(serviceConfig(2)) 30 | assert.NilError(t, err) 31 | assert.Equal(t, hash1, hash2) 32 | } 33 | 34 | func serviceConfig(replicas int) types.ServiceConfig { 35 | return types.ServiceConfig{ 36 | Scale: &replicas, 37 | Deploy: &types.DeployConfig{ 38 | Replicas: &replicas, 39 | }, 40 | Name: "foo", 41 | Image: "bar", 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /pkg/compose/plugins_windows.go: -------------------------------------------------------------------------------- 1 | //go:build windows 2 | 3 | /* 4 | Copyright 2020 Docker Compose CLI authors 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package compose 20 | 21 | func executable(s string) string { 22 | return s + ".exe" 23 | } 24 | -------------------------------------------------------------------------------- /pkg/compose/scale.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package compose 17 | 18 | import ( 19 | "context" 20 | 21 | "github.com/compose-spec/compose-go/v2/types" 22 | "github.com/docker/compose/v2/internal/tracing" 23 | "github.com/docker/compose/v2/pkg/api" 24 | "github.com/docker/compose/v2/pkg/progress" 25 | ) 26 | 27 | func (s *composeService) Scale(ctx context.Context, project *types.Project, options api.ScaleOptions) error { 28 | return progress.Run(ctx, tracing.SpanWrapFunc("project/scale", tracing.ProjectOptions(ctx, project), func(ctx context.Context) error { 29 | err := s.create(ctx, project, api.CreateOptions{Services: options.Services}) 30 | if err != nil { 31 | return err 32 | } 33 | return s.start(ctx, project.Name, api.StartOptions{Project: project, Services: options.Services}, nil) 34 | }), s.stdinfo()) 35 | } 36 | -------------------------------------------------------------------------------- /pkg/compose/suffix_unix.go: -------------------------------------------------------------------------------- 1 | //go:build !windows 2 | 3 | /* 4 | Copyright 2020 Docker Compose CLI authors 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package compose 20 | 21 | func executable(s string) string { 22 | return s 23 | } 24 | -------------------------------------------------------------------------------- /pkg/compose/testdata/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | service1: 3 | image: nginx 4 | service2: 5 | image: mysql 6 | -------------------------------------------------------------------------------- /pkg/compose/testdata/publish/common.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | foo: 3 | image: bar 4 | -------------------------------------------------------------------------------- /pkg/compose/testdata/publish/compose.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | services: 3 | test: 4 | extends: 5 | file: common.yaml 6 | service: foo 7 | -------------------------------------------------------------------------------- /pkg/e2e/assert.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package e2e 18 | 19 | import ( 20 | "encoding/json" 21 | "strings" 22 | "testing" 23 | 24 | "github.com/stretchr/testify/require" 25 | ) 26 | 27 | // RequireServiceState ensures that the container is in the expected state 28 | // (running or exited). 29 | func RequireServiceState(t testing.TB, cli *CLI, service string, state string) { 30 | t.Helper() 31 | psRes := cli.RunDockerComposeCmd(t, "ps", "--all", "--format=json", service) 32 | var svc map[string]interface{} 33 | require.NoError(t, json.Unmarshal([]byte(psRes.Stdout()), &svc), 34 | "Invalid `compose ps` JSON: command output: %s", 35 | psRes.Combined()) 36 | 37 | require.Equal(t, service, svc["Service"], 38 | "Found ps output for unexpected service") 39 | require.Equalf(t, 40 | strings.ToLower(state), 41 | strings.ToLower(svc["State"].(string)), 42 | "Service %q (%s) not in expected state", 43 | service, svc["Name"], 44 | ) 45 | } 46 | -------------------------------------------------------------------------------- /pkg/e2e/e2e_config_plugin.go: -------------------------------------------------------------------------------- 1 | //go:build !standalone 2 | 3 | /* 4 | Copyright 2020 Docker Compose CLI authors 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package e2e 20 | 21 | const composeStandaloneMode = false 22 | -------------------------------------------------------------------------------- /pkg/e2e/e2e_config_standalone.go: -------------------------------------------------------------------------------- 1 | //go:build standalone 2 | 3 | /* 4 | Copyright 2020 Docker Compose CLI authors 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package e2e 20 | 21 | const composeStandaloneMode = true 22 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/attach-restart/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | failing: 3 | image: alpine 4 | command: sh -c "sleep 0.1 && echo world && /bin/false" 5 | deploy: 6 | restart_policy: 7 | condition: "on-failure" 8 | max_attempts: 2 9 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM alpine 16 | ENV ENV_FROM_DOCKERFILE=1 17 | EXPOSE 8081 18 | CMD ["echo", "Hello from Dockerfile"] 19 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | serviceA: 3 | image: alpine 4 | build: . 5 | ports: 6 | - 80:8080 7 | networks: 8 | - private-network 9 | configs: 10 | - source: my-config 11 | target: /etc/my-config1.txt 12 | serviceB: 13 | image: alpine 14 | build: . 15 | ports: 16 | - 8081:8082 17 | secrets: 18 | - my-secrets 19 | networks: 20 | - private-network 21 | - public-network 22 | configs: 23 | my-config: 24 | file: my-config.txt 25 | secrets: 26 | my-secrets: 27 | file: not-so-secret.txt 28 | networks: 29 | private-network: 30 | internal: true 31 | public-network: {} 32 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-helm/Chart.yaml: -------------------------------------------------------------------------------- 1 | #! Chart.yaml 2 | apiVersion: v2 3 | name: bridge 4 | version: 0.0.1 5 | # kubeVersion: >= 1.29.1 6 | description: A generated Helm Chart for bridge generated via compose-bridge. 7 | type: application 8 | keywords: 9 | - bridge 10 | appVersion: 'v0.0.1' 11 | sources: 12 | annotations: 13 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-helm/templates/0-bridge-namespace.yaml: -------------------------------------------------------------------------------- 1 | #! 0-bridge-namespace.yaml 2 | # Generated code, do not edit 3 | apiVersion: v1 4 | kind: Namespace 5 | metadata: 6 | name: bridge 7 | labels: 8 | com.docker.compose.project: bridge 9 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-helm/templates/bridge-configs.yaml: -------------------------------------------------------------------------------- 1 | #! bridge-configs.yaml 2 | # Generated code, do not edit 3 | apiVersion: v1 4 | kind: ConfigMap 5 | metadata: 6 | name: bridge 7 | namespace: bridge 8 | labels: 9 | com.docker.compose.project: bridge 10 | data: 11 | my-config: | 12 | My config file 13 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-helm/templates/my-secrets-secret.yaml: -------------------------------------------------------------------------------- 1 | #! my-secrets-secret.yaml 2 | # Generated code, do not edit 3 | apiVersion: v1 4 | kind: Secret 5 | metadata: 6 | name: my-secrets 7 | namespace: {{ .Values.namespace }} 8 | labels: 9 | com.docker.compose.project: bridge 10 | com.docker.compose.secret: my-secrets 11 | data: 12 | my-secrets: bm90LXNlY3JldA== 13 | type: Opaque 14 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-helm/templates/private-network-network-policy.yaml: -------------------------------------------------------------------------------- 1 | #! private-network-network-policy.yaml 2 | # Generated code, do not edit 3 | apiVersion: networking.k8s.io/v1 4 | kind: NetworkPolicy 5 | metadata: 6 | name: private-network-network-policy 7 | namespace: {{ .Values.namespace }} 8 | spec: 9 | podSelector: 10 | matchLabels: 11 | com.docker.compose.network.private-network: "true" 12 | policyTypes: 13 | - Ingress 14 | - Egress 15 | ingress: 16 | - from: 17 | - podSelector: 18 | matchLabels: 19 | com.docker.compose.network.private-network: "true" 20 | egress: 21 | - to: 22 | - podSelector: 23 | matchLabels: 24 | com.docker.compose.network.private-network: "true" 25 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-helm/templates/public-network-network-policy.yaml: -------------------------------------------------------------------------------- 1 | #! public-network-network-policy.yaml 2 | # Generated code, do not edit 3 | apiVersion: networking.k8s.io/v1 4 | kind: NetworkPolicy 5 | metadata: 6 | name: public-network-network-policy 7 | namespace: {{ .Values.namespace }} 8 | spec: 9 | podSelector: 10 | matchLabels: 11 | com.docker.compose.network.public-network: "true" 12 | policyTypes: 13 | - Ingress 14 | - Egress 15 | ingress: 16 | - from: 17 | - podSelector: 18 | matchLabels: 19 | com.docker.compose.network.public-network: "true" 20 | egress: 21 | - to: 22 | - podSelector: 23 | matchLabels: 24 | com.docker.compose.network.public-network: "true" 25 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-helm/templates/serviceA-expose.yaml: -------------------------------------------------------------------------------- 1 | #! serviceA-expose.yaml 2 | # Generated code, do not edit 3 | apiVersion: v1 4 | kind: Service 5 | metadata: 6 | name: servicea 7 | namespace: {{ .Values.namespace }} 8 | labels: 9 | com.docker.compose.project: bridge 10 | com.docker.compose.service: serviceA 11 | app.kubernetes.io/managed-by: Helm 12 | spec: 13 | selector: 14 | com.docker.compose.project: bridge 15 | com.docker.compose.service: serviceA 16 | ports: 17 | - name: servicea-8080 18 | port: 8080 19 | targetPort: servicea-8080 20 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-helm/templates/serviceA-service.yaml: -------------------------------------------------------------------------------- 1 | # check if there is at least one published port 2 | 3 | #! serviceA-service.yaml 4 | # Generated code, do not edit 5 | apiVersion: v1 6 | kind: Service 7 | metadata: 8 | name: servicea-published 9 | namespace: {{ .Values.namespace }} 10 | labels: 11 | com.docker.compose.project: bridge 12 | com.docker.compose.service: serviceA 13 | app.kubernetes.io/managed-by: Helm 14 | spec: 15 | type: LoadBalancer 16 | selector: 17 | com.docker.compose.project: bridge 18 | com.docker.compose.service: serviceA 19 | ports: 20 | - name: servicea-80 21 | port: 80 22 | protocol: TCP 23 | targetPort: servicea-8080 24 | 25 | # check if there is at least one published port 26 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-helm/templates/serviceB-expose.yaml: -------------------------------------------------------------------------------- 1 | #! serviceB-expose.yaml 2 | # Generated code, do not edit 3 | apiVersion: v1 4 | kind: Service 5 | metadata: 6 | name: serviceb 7 | namespace: {{ .Values.namespace }} 8 | labels: 9 | com.docker.compose.project: bridge 10 | com.docker.compose.service: serviceB 11 | app.kubernetes.io/managed-by: Helm 12 | spec: 13 | selector: 14 | com.docker.compose.project: bridge 15 | com.docker.compose.service: serviceB 16 | ports: 17 | - name: serviceb-8082 18 | port: 8082 19 | targetPort: serviceb-8082 20 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-helm/templates/serviceB-service.yaml: -------------------------------------------------------------------------------- 1 | #! serviceB-service.yaml 2 | # Generated code, do not edit 3 | apiVersion: v1 4 | kind: Service 5 | metadata: 6 | name: serviceb-published 7 | namespace: {{ .Values.namespace }} 8 | labels: 9 | com.docker.compose.project: bridge 10 | com.docker.compose.service: serviceB 11 | app.kubernetes.io/managed-by: Helm 12 | spec: 13 | type: LoadBalancer 14 | selector: 15 | com.docker.compose.project: bridge 16 | com.docker.compose.service: serviceB 17 | ports: 18 | - name: serviceb-8081 19 | port: 8081 20 | protocol: TCP 21 | targetPort: serviceb-8082 22 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-helm/values.yaml: -------------------------------------------------------------------------------- 1 | #! values.yaml 2 | # Namespace 3 | namespace: bridge 4 | # Services variables 5 | 6 | serviceA: 7 | image: alpine 8 | imagePullPolicy: IfNotPresent 9 | serviceB: 10 | image: alpine 11 | imagePullPolicy: IfNotPresent 12 | 13 | # You can apply the same logic to loop on networks, volumes, secrets and configs... 14 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-kubernetes/base/0-bridge-namespace.yaml: -------------------------------------------------------------------------------- 1 | #! 0-bridge-namespace.yaml 2 | # Generated code, do not edit 3 | apiVersion: v1 4 | kind: Namespace 5 | metadata: 6 | name: bridge 7 | labels: 8 | com.docker.compose.project: bridge 9 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-kubernetes/base/bridge-configs.yaml: -------------------------------------------------------------------------------- 1 | #! bridge-configs.yaml 2 | # Generated code, do not edit 3 | apiVersion: v1 4 | kind: ConfigMap 5 | metadata: 6 | name: bridge 7 | namespace: bridge 8 | labels: 9 | com.docker.compose.project: bridge 10 | data: 11 | my-config: | 12 | My config file 13 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-kubernetes/base/kustomization.yaml: -------------------------------------------------------------------------------- 1 | #! kustomization.yaml 2 | # Generated code, do not edit 3 | apiVersion: kustomize.config.k8s.io/v1beta1 4 | kind: Kustomization 5 | resources: 6 | - 0-bridge-namespace.yaml 7 | - bridge-configs.yaml 8 | - my-secrets-secret.yaml 9 | - private-network-network-policy.yaml 10 | - public-network-network-policy.yaml 11 | - serviceA-deployment.yaml 12 | - serviceA-expose.yaml 13 | - serviceA-service.yaml 14 | - serviceB-deployment.yaml 15 | - serviceB-expose.yaml 16 | - serviceB-service.yaml 17 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-kubernetes/base/my-secrets-secret.yaml: -------------------------------------------------------------------------------- 1 | #! my-secrets-secret.yaml 2 | # Generated code, do not edit 3 | apiVersion: v1 4 | kind: Secret 5 | metadata: 6 | name: my-secrets 7 | namespace: bridge 8 | labels: 9 | com.docker.compose.project: bridge 10 | com.docker.compose.secret: my-secrets 11 | data: 12 | my-secrets: bm90LXNlY3JldA== 13 | type: Opaque 14 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-kubernetes/base/private-network-network-policy.yaml: -------------------------------------------------------------------------------- 1 | #! private-network-network-policy.yaml 2 | # Generated code, do not edit 3 | apiVersion: networking.k8s.io/v1 4 | kind: NetworkPolicy 5 | metadata: 6 | name: private-network-network-policy 7 | namespace: bridge 8 | spec: 9 | podSelector: 10 | matchLabels: 11 | com.docker.compose.network.private-network: "true" 12 | policyTypes: 13 | - Ingress 14 | - Egress 15 | ingress: 16 | - from: 17 | - podSelector: 18 | matchLabels: 19 | com.docker.compose.network.private-network: "true" 20 | egress: 21 | - to: 22 | - podSelector: 23 | matchLabels: 24 | com.docker.compose.network.private-network: "true" 25 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-kubernetes/base/public-network-network-policy.yaml: -------------------------------------------------------------------------------- 1 | #! public-network-network-policy.yaml 2 | # Generated code, do not edit 3 | apiVersion: networking.k8s.io/v1 4 | kind: NetworkPolicy 5 | metadata: 6 | name: public-network-network-policy 7 | namespace: bridge 8 | spec: 9 | podSelector: 10 | matchLabels: 11 | com.docker.compose.network.public-network: "true" 12 | policyTypes: 13 | - Ingress 14 | - Egress 15 | ingress: 16 | - from: 17 | - podSelector: 18 | matchLabels: 19 | com.docker.compose.network.public-network: "true" 20 | egress: 21 | - to: 22 | - podSelector: 23 | matchLabels: 24 | com.docker.compose.network.public-network: "true" 25 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-kubernetes/base/serviceA-expose.yaml: -------------------------------------------------------------------------------- 1 | #! serviceA-expose.yaml 2 | # Generated code, do not edit 3 | apiVersion: v1 4 | kind: Service 5 | metadata: 6 | name: servicea 7 | namespace: bridge 8 | labels: 9 | com.docker.compose.project: bridge 10 | com.docker.compose.service: serviceA 11 | spec: 12 | selector: 13 | com.docker.compose.project: bridge 14 | com.docker.compose.service: serviceA 15 | ports: 16 | - name: servicea-8080 17 | port: 8080 18 | targetPort: servicea-8080 19 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-kubernetes/base/serviceA-service.yaml: -------------------------------------------------------------------------------- 1 | # check if there is at least one published port 2 | 3 | #! serviceA-service.yaml 4 | # Generated code, do not edit 5 | apiVersion: v1 6 | kind: Service 7 | metadata: 8 | name: servicea-published 9 | namespace: bridge 10 | labels: 11 | com.docker.compose.project: bridge 12 | com.docker.compose.service: serviceA 13 | spec: 14 | selector: 15 | com.docker.compose.project: bridge 16 | com.docker.compose.service: serviceA 17 | ports: 18 | - name: servicea-80 19 | port: 80 20 | protocol: TCP 21 | targetPort: servicea-8080 22 | 23 | # check if there is at least one published port 24 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-kubernetes/base/serviceB-expose.yaml: -------------------------------------------------------------------------------- 1 | #! serviceB-expose.yaml 2 | # Generated code, do not edit 3 | apiVersion: v1 4 | kind: Service 5 | metadata: 6 | name: serviceb 7 | namespace: bridge 8 | labels: 9 | com.docker.compose.project: bridge 10 | com.docker.compose.service: serviceB 11 | spec: 12 | selector: 13 | com.docker.compose.project: bridge 14 | com.docker.compose.service: serviceB 15 | ports: 16 | - name: serviceb-8082 17 | port: 8082 18 | targetPort: serviceb-8082 19 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-kubernetes/base/serviceB-service.yaml: -------------------------------------------------------------------------------- 1 | #! serviceB-service.yaml 2 | # Generated code, do not edit 3 | apiVersion: v1 4 | kind: Service 5 | metadata: 6 | name: serviceb-published 7 | namespace: bridge 8 | labels: 9 | com.docker.compose.project: bridge 10 | com.docker.compose.service: serviceB 11 | spec: 12 | selector: 13 | com.docker.compose.project: bridge 14 | com.docker.compose.service: serviceB 15 | ports: 16 | - name: serviceb-8081 17 | port: 8081 18 | protocol: TCP 19 | targetPort: serviceb-8082 20 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-kubernetes/overlays/desktop/kustomization.yaml: -------------------------------------------------------------------------------- 1 | #! kustomization.yaml 2 | # Generated code, do not edit 3 | apiVersion: kustomize.config.k8s.io/v1beta1 4 | kind: Kustomization 5 | resources: 6 | - ../../base 7 | patches: 8 | - path: serviceA-service.yaml 9 | - path: serviceB-service.yaml 10 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-kubernetes/overlays/desktop/serviceA-service.yaml: -------------------------------------------------------------------------------- 1 | # check if there is at least one published port 2 | 3 | #! serviceA-service.yaml 4 | # Generated code, do not edit 5 | apiVersion: v1 6 | kind: Service 7 | metadata: 8 | name: servicea-published 9 | namespace: bridge 10 | spec: 11 | type: LoadBalancer 12 | 13 | # check if there is at least one published port 14 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/expected-kubernetes/overlays/desktop/serviceB-service.yaml: -------------------------------------------------------------------------------- 1 | #! serviceB-service.yaml 2 | # Generated code, do not edit 3 | apiVersion: v1 4 | kind: Service 5 | metadata: 6 | name: serviceb-published 7 | namespace: bridge 8 | spec: 9 | type: LoadBalancer 10 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/my-config.txt: -------------------------------------------------------------------------------- 1 | My config file -------------------------------------------------------------------------------- /pkg/e2e/fixtures/bridge/not-so-secret.txt: -------------------------------------------------------------------------------- 1 | not-secret -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-dependencies/base.dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM alpine 16 | 17 | COPY hello.txt /hello.txt 18 | 19 | CMD [ "/bin/true" ] 20 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-dependencies/classic.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | base: 3 | image: base 4 | init: true 5 | build: 6 | context: . 7 | dockerfile: base.dockerfile 8 | service: 9 | init: true 10 | depends_on: 11 | - base 12 | build: 13 | context: . 14 | dockerfile: service.dockerfile 15 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-dependencies/compose-depends_on.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | test1: 3 | pull_policy: build 4 | build: 5 | dockerfile_inline: FROM alpine 6 | command: 7 | - echo 8 | - "test 1 success" 9 | test2: 10 | image: alpine 11 | depends_on: 12 | - test1 13 | command: 14 | - echo 15 | - "test 2 success" -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-dependencies/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | base: 3 | init: true 4 | build: 5 | context: . 6 | dockerfile: base.dockerfile 7 | service: 8 | init: true 9 | build: 10 | context: . 11 | additional_contexts: 12 | base: "service:base" 13 | dockerfile: service.dockerfile 14 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-dependencies/hello.txt: -------------------------------------------------------------------------------- 1 | this file was copied from base -> service 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-dependencies/service.dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM base 16 | 17 | CMD [ "cat", "/hello.txt" ] 18 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-infinite/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | service1: 3 | build: service1 -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-infinite/service1/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM busybox 16 | 17 | RUN sleep infinity -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | nginx: 3 | build: nginx-build 4 | ports: 5 | - 8070:80 6 | 7 | nginx2: 8 | build: nginx-build2 9 | image: custom-nginx 10 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/entitlements/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax = docker/dockerfile:experimental 2 | 3 | 4 | # Copyright 2020 Docker Compose CLI authors 5 | 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | FROM alpine 19 | RUN --security=insecure cat /proc/self/status | grep CapEff 20 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/entitlements/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | privileged-service: 3 | build: 4 | context: . 5 | entitlements: 6 | - security.insecure 7 | 8 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/multi-args/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ARG IMAGE=666 16 | ARG TAG=666 17 | 18 | FROM ${IMAGE}:${TAG} 19 | RUN echo "SUCCESS" 20 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/multi-args/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | multiargs: 3 | build: 4 | context: . 5 | args: 6 | IMAGE: alpine 7 | TAG: latest 8 | labels: 9 | - RESULT=SUCCESS 10 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/nginx-build/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM nginx:alpine 16 | 17 | ARG FOO 18 | LABEL FOO=$FOO 19 | COPY static /usr/share/nginx/html 20 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/nginx-build/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Static file 2 6 | 7 | 8 |

Hello from Nginx container

9 | 10 | 11 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/nginx-build2/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM nginx:alpine 16 | 17 | COPY static2 /usr/share/nginx/html 18 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/nginx-build2/static2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Static file 2 6 | 7 | 8 |

Hello from Nginx container

9 | 10 | 11 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/platforms/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM --platform=$BUILDPLATFORM golang:alpine AS build 16 | 17 | ARG TARGETPLATFORM 18 | ARG BUILDPLATFORM 19 | RUN echo "I am building for $TARGETPLATFORM, running on $BUILDPLATFORM" > /log 20 | 21 | FROM alpine 22 | COPY --from=build /log /log 23 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/platforms/compose-multiple-platform-builds.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | serviceA: 3 | image: build-test-platform-a:test 4 | build: 5 | context: ./contextServiceA 6 | platforms: 7 | - linux/amd64 8 | - linux/arm64 9 | serviceB: 10 | image: build-test-platform-b:test 11 | build: 12 | context: ./contextServiceB 13 | platforms: 14 | - linux/amd64 15 | - linux/arm64 16 | serviceC: 17 | image: build-test-platform-c:test 18 | build: 19 | context: ./contextServiceC 20 | platforms: 21 | - linux/amd64 22 | - linux/arm64 23 | 24 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/platforms/compose-service-platform-and-no-build-platforms.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | platforms: 3 | image: build-test-platform:test 4 | platform: linux/386 5 | build: 6 | context: . 7 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/platforms/compose-service-platform-not-in-build-platforms.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | platforms: 3 | image: build-test-platform:test 4 | platform: linux/riscv64 5 | build: 6 | context: . 7 | platforms: 8 | - linux/amd64 9 | - linux/arm64 10 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/platforms/compose-unsupported-platform.yml: -------------------------------------------------------------------------------- 1 | services: 2 | platforms: 3 | image: build-test-platform:test 4 | build: 5 | context: . 6 | platforms: 7 | - unsupported/unsupported 8 | - linux/amd64 9 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/platforms/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | platforms: 3 | image: build-test-platform:test 4 | build: 5 | context: . 6 | platforms: 7 | - linux/amd64 8 | - linux/arm64 9 | 10 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/platforms/contextServiceA/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM --platform=$BUILDPLATFORM golang:alpine AS build 16 | 17 | ARG TARGETPLATFORM 18 | ARG BUILDPLATFORM 19 | RUN echo "I'm Service A and I am building for $TARGETPLATFORM, running on $BUILDPLATFORM" > /log 20 | 21 | FROM alpine 22 | COPY --from=build /log /log 23 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/platforms/contextServiceB/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM --platform=$BUILDPLATFORM golang:alpine AS build 16 | 17 | ARG TARGETPLATFORM 18 | ARG BUILDPLATFORM 19 | RUN echo "I'm Service B and I am building for $TARGETPLATFORM, running on $BUILDPLATFORM" > /log 20 | 21 | FROM alpine 22 | COPY --from=build /log /log 23 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/platforms/contextServiceC/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM --platform=$BUILDPLATFORM golang:alpine AS build 16 | 17 | ARG TARGETPLATFORM 18 | ARG BUILDPLATFORM 19 | RUN echo "I'm Service C and I am building for $TARGETPLATFORM, running on $BUILDPLATFORM" > /log 20 | 21 | FROM alpine 22 | COPY --from=build /log /log 23 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/privileged/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax = docker/dockerfile:experimental 2 | 3 | 4 | # Copyright 2020 Docker Compose CLI authors 5 | 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | FROM alpine 19 | RUN --security=insecure cat /proc/self/status | grep CapEff 20 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/privileged/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | privileged-service: 3 | build: 4 | context: . 5 | privileged: true 6 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/secrets/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | 4 | # Copyright 2020 Docker Compose CLI authors 5 | 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | FROM alpine 19 | 20 | RUN echo "foo" > /tmp/expected 21 | RUN --mount=type=secret,id=mysecret cat /run/secrets/mysecret > /tmp/actual 22 | RUN diff /tmp/expected /tmp/actual 23 | 24 | RUN echo "bar" > /tmp/expected 25 | RUN --mount=type=secret,id=build_secret cat /run/secrets/build_secret > tmp/actual 26 | RUN diff --ignore-all-space /tmp/expected /tmp/actual 27 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/secrets/compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | ssh: 3 | image: build-test-secret 4 | build: 5 | context: . 6 | secrets: 7 | - mysecret 8 | - source: envsecret 9 | target: build_secret 10 | 11 | secrets: 12 | mysecret: 13 | file: ./secret.txt 14 | envsecret: 15 | environment: SOME_SECRET 16 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/secrets/secret.txt: -------------------------------------------------------------------------------- 1 | foo 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/ssh/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | 4 | # Copyright 2020 Docker Compose CLI authors 5 | 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | FROM alpine 19 | RUN apk add --no-cache openssh-client 20 | 21 | WORKDIR /compose 22 | COPY fake_rsa.pub /compose/ 23 | 24 | RUN --mount=type=ssh,id=fake-ssh,required=true diff <(ssh-add -L) <(cat /compose/fake_rsa.pub) -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/ssh/compose-without-ssh.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | ssh: 3 | image: build-test-ssh 4 | build: 5 | context: . 6 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/ssh/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | ssh: 3 | image: build-test-ssh 4 | build: 5 | context: . 6 | ssh: 7 | - fake-ssh=./fake_rsa 8 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/ssh/fake_rsa.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDucnjECEntXAjre25rLcMIdpNd4Rj3Yfpg1nym0AgFjSZSfoZz2az3ge9wAp6YImQ7R/LpTYk6hJP6rVg8Al/zo2shTjWFl3OvDZB2ob8DeNrhVMBo4lsf3Bp8oelYuzqTKKAa2LcpIFpubgcBFTyWC1EToC4ILX6bDzbUXNOwxYzFGn+spXGCyIxSx13ntZEo52fxNGbo0dwSzLtfvMAnv4KH+a4YYIKTdn35hTOhVW1j/AZiZZdeP81TPGcSrRcvI7wcL5BT/11aWHU4uagy7E3WVi0dEVZay0Jugo2w5wiImwsp9DW3jPiNerk/slMsTk+eB6auvjErbVEWNVoZCk6PJCBmfWjTAC/Lvwo5HCA3QSXBxv9cgol6nPN7MIjJeVJp95e4c/6gyMzazYxc0eUwq/onCHhBjBRDrX5sBw+RyYh2W2IAw0tzFiKoS53zkRBCX1yK6EwprRtmXU4QgvBVIhqwS70EQpWvPnZllUsYxyGo5X/h/U+o8RqCd+dFgS20noC5phRole9JA/pmPgAVvpas/AQEgU64Af2Lha0bnZAArq5zXCw9mUebwn5WdMQEoW4YRG7+4kFY+jjcuO7xWse5lTxB440REp8ltzUQj1empaL7dVxZPRAm3EQZbZiYPnTn5wo1zfXHA61yrCiC3BPTCe6PQEB/fcdjfw== 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/tags/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM nginx:alpine 16 | 17 | RUN echo "SUCCESS" 18 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/build-test/tags/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | nginx: 3 | image: build-test-tags 4 | build: 5 | context: . 6 | tags: 7 | - docker.io/docker/build-test-tags:1.0.0 8 | - other-image-name:v1.0.0 9 | 10 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/cascade/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | running: 3 | image: alpine 4 | command: sleep infinity 5 | init: true 6 | 7 | exit: 8 | image: alpine 9 | command: /bin/true 10 | depends_on: 11 | running: 12 | condition: service_started 13 | 14 | fail: 15 | image: alpine 16 | command: sh -c "return 111" 17 | depends_on: 18 | exit: 19 | condition: service_completed_successfully 20 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/commit/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | service: 3 | image: alpine 4 | command: sleep infinity 5 | service-with-replicas: 6 | image: alpine 7 | command: sleep infinity 8 | deploy: 9 | replicas: 3 -------------------------------------------------------------------------------- /pkg/e2e/fixtures/compose-pull/duplicate-images/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | simple: 3 | image: alpine:3.13 4 | command: top 5 | another: 6 | image: alpine:3.13 7 | command: top 8 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/compose-pull/image-present-locally/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | simple: 3 | image: alpine:3.13.12 4 | pull_policy: missing 5 | command: top 6 | latest: 7 | image: alpine:latest 8 | pull_policy: missing 9 | command: top 10 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/compose-pull/no-image-name-given/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | no-image-service: 3 | build: . 4 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/compose-pull/simple/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | simple: 3 | image: alpine:3.14 4 | command: top 5 | another: 6 | image: alpine:3.15 7 | command: top 8 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/compose-pull/unknown-image/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM alpine:3.15 16 | 17 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/compose-pull/unknown-image/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | fail: 3 | image: does_not_exists 4 | can_build: 5 | image: doesn_t_exists_either 6 | build: . 7 | valid: 8 | image: alpine:3.15 9 | 10 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/config/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | test: 3 | image: test 4 | ports: 5 | - ${PORT:-8080}:80 -------------------------------------------------------------------------------- /pkg/e2e/fixtures/configs/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | from_env: 3 | image: alpine 4 | configs: 5 | - source: from_env 6 | command: cat /from_env 7 | 8 | from_file: 9 | image: alpine 10 | configs: 11 | - source: from_file 12 | command: cat /from_file 13 | 14 | inlined: 15 | image: alpine 16 | configs: 17 | - source: inlined 18 | command: cat /inlined 19 | 20 | target: 21 | image: alpine 22 | configs: 23 | - source: inlined 24 | target: /target 25 | command: cat /target 26 | 27 | configs: 28 | from_env: 29 | environment: CONFIG 30 | from_file: 31 | file: config.txt 32 | inlined: 33 | content: This is my $CONFIG 34 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/configs/config.txt: -------------------------------------------------------------------------------- 1 | This is my config file 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/container_name/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | test: 3 | image: alpine 4 | container_name: test 5 | command: /bin/true 6 | 7 | another_test: 8 | image: alpine 9 | container_name: test 10 | command: /bin/true 11 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/cp-test/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | nginx: 3 | image: nginx:alpine -------------------------------------------------------------------------------- /pkg/e2e/fixtures/cp-test/cp-folder/cp-me.txt: -------------------------------------------------------------------------------- 1 | hello world from folder -------------------------------------------------------------------------------- /pkg/e2e/fixtures/cp-test/cp-me.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /pkg/e2e/fixtures/dependencies/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM busybox:1.35.0 16 | RUN echo "hello" -------------------------------------------------------------------------------- /pkg/e2e/fixtures/dependencies/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | foo: 3 | image: nginx:alpine 4 | command: "${COMMAND}" 5 | depends_on: 6 | - bar 7 | 8 | bar: 9 | image: nginx:alpine 10 | scale: 2 11 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/dependencies/dependency-exit.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | web: 3 | image: nginx:alpine 4 | depends_on: 5 | db: 6 | condition: service_healthy 7 | db: 8 | image: alpine 9 | command: sh -c "exit 1" 10 | 11 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/dependencies/deps-completed-successfully.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | oneshot: 3 | image: alpine 4 | command: echo 'hello world' 5 | longrunning: 6 | image: alpine 7 | init: true 8 | depends_on: 9 | oneshot: 10 | condition: service_completed_successfully 11 | command: sleep infinity 12 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/dependencies/deps-not-required.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | foo: 3 | image: bash 4 | command: echo "foo" 5 | depends_on: 6 | bar: 7 | required: false 8 | condition: service_healthy 9 | bar: 10 | image: nginx:alpine 11 | profiles: [not-required] -------------------------------------------------------------------------------- /pkg/e2e/fixtures/dependencies/recreate-no-deps.yaml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | services: 3 | my-service: 4 | image: alpine 5 | command: tail -f /dev/null 6 | init: true 7 | depends_on: 8 | nginx: {condition: service_healthy} 9 | 10 | nginx: 11 | image: nginx:alpine 12 | healthcheck: 13 | test: "echo | nc -w 5 localhost:80" 14 | interval: 2s 15 | timeout: 1s 16 | retries: 10 17 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/dependencies/service-image-depends-on.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | foo: 3 | image: built-image-dependency 4 | build: 5 | context: . 6 | bar: 7 | image: built-image-dependency 8 | depends_on: 9 | - foo 10 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/dotenv/.env: -------------------------------------------------------------------------------- 1 | COMPOSE_FILE="${COMPOSE_FILE:-development/compose.yaml}" 2 | IMAGE_NAME=test 3 | COMPOSE_PROFILES=test -------------------------------------------------------------------------------- /pkg/e2e/fixtures/dotenv/.env.raw: -------------------------------------------------------------------------------- 1 | TEST_VAR='{"key": "value"}' -------------------------------------------------------------------------------- /pkg/e2e/fixtures/dotenv/development/.env: -------------------------------------------------------------------------------- 1 | IMAGE_NAME="${IMAGE_NAME:-backend}" 2 | IMAGE_TAG="${IMAGE_TAG:-latest}" 3 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/dotenv/development/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | backend: 3 | image: $IMAGE_NAME:$IMAGE_TAG 4 | test: 5 | profiles: 6 | - test 7 | image: enabled:profile -------------------------------------------------------------------------------- /pkg/e2e/fixtures/dotenv/raw.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | test: 3 | image: alpine 4 | command: sh -c "echo $$TEST_VAR" 5 | env_file: 6 | - path: .env.raw 7 | format: raw # parse without interpolation -------------------------------------------------------------------------------- /pkg/e2e/fixtures/env-secret/child/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | included: 3 | image: alpine 4 | secrets: 5 | - my-secret 6 | command: cat /run/secrets/my-secret 7 | 8 | secrets: 9 | my-secret: 10 | environment: 'MY_SECRET' 11 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/env-secret/compose.yaml: -------------------------------------------------------------------------------- 1 | include: 2 | - path: child/compose.yaml 3 | env_file: 4 | - secret.env 5 | 6 | services: 7 | foo: 8 | image: alpine 9 | secrets: 10 | - source: secret 11 | target: bar 12 | uid: "1005" 13 | gid: "1005" 14 | mode: 0440 15 | command: cat /run/secrets/bar 16 | 17 | secrets: 18 | secret: 19 | environment: SECRET 20 | 21 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/env-secret/secret.env: -------------------------------------------------------------------------------- 1 | MY_SECRET='this-is-secret' 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/env_file/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | serviceA: 3 | image: nginx:latest 4 | 5 | serviceB: 6 | image: nginx:latest 7 | env_file: 8 | - /doesnotexist/.env 9 | 10 | serviceC: 11 | profiles: ["test"] 12 | image: alpine 13 | env_file: test.env 14 | 15 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/env_file/test.env: -------------------------------------------------------------------------------- 1 | FOO=BAR -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/empty-variable/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM alpine 16 | ENV EMPTY=not_empty 17 | CMD ["sh", "-c", "echo \"=$EMPTY=\""] 18 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/empty-variable/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | empty-variable: 3 | build: 4 | context: . 5 | image: empty-variable 6 | environment: 7 | - EMPTY # expect to propagate value from user's env OR unset in container -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/env-file-comments/.env: -------------------------------------------------------------------------------- 1 | COMMENT=1234#5 2 | NO_COMMENT="1234#5" 3 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/env-file-comments/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM alpine 16 | ENV COMMENT=Dockerfile 17 | ENV NO_COMMENT=Dockerfile 18 | CMD ["sh", "-c", "printenv", "|", "grep", "COMMENT"] 19 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/env-file-comments/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | env-file-comments: 3 | build: 4 | context: . 5 | image: env-file-comments -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/env-interpolation-default-value/.env: -------------------------------------------------------------------------------- 1 | IMAGE=default_env:${WHEREAMI:-EnvFileDefaultValue} 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/env-interpolation-default-value/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | env-interpolation: 3 | image: bash 4 | environment: 5 | IMAGE: ${IMAGE} 6 | command: echo "$IMAGE" 7 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/env-interpolation/.env: -------------------------------------------------------------------------------- 1 | WHEREAMI=EnvFile 2 | IMAGE=default_env:${WHEREAMI} 3 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/env-interpolation/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | env-interpolation: 3 | image: bash 4 | environment: 5 | IMAGE: ${IMAGE} 6 | command: echo "$IMAGE" -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/env-priority/.env: -------------------------------------------------------------------------------- 1 | WHEREAMI=Env File 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/env-priority/.env.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docker/compose/f4fc010d6b9bbd40e0ab6e3706a49ee459a2d181/pkg/e2e/fixtures/environment/env-priority/.env.empty -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/env-priority/.env.override: -------------------------------------------------------------------------------- 1 | WHEREAMI=override 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/env-priority/.env.override.with.default: -------------------------------------------------------------------------------- 1 | WHEREAMI=${WHEREAMI:-EnvFileDefaultValue} 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/env-priority/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM alpine 16 | ENV WHEREAMI=Dockerfile 17 | CMD ["printenv", "WHEREAMI"] 18 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/env-priority/compose-with-env-file.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | env-compose-priority: 3 | image: env-compose-priority 4 | build: 5 | context: . 6 | env_file: 7 | - .env.override 8 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/env-priority/compose-with-env.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | env-compose-priority: 3 | image: env-compose-priority 4 | build: 5 | context: . 6 | environment: 7 | WHEREAMI: "Compose File" 8 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/environment/env-priority/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | env-compose-priority: 3 | image: env-compose-priority 4 | build: 5 | context: . 6 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/export/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | service: 3 | image: alpine 4 | command: sleep infinity 5 | service-with-replicas: 6 | image: alpine 7 | command: sleep infinity 8 | deploy: 9 | replicas: 3 -------------------------------------------------------------------------------- /pkg/e2e/fixtures/external/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | test: 3 | image: nginx:alpine 4 | 5 | other: 6 | image: nginx:alpine 7 | networks: 8 | test_network: 9 | ipv4_address: 8.8.8.8 10 | 11 | networks: 12 | test_network: 13 | external: true 14 | name: foo_bar -------------------------------------------------------------------------------- /pkg/e2e/fixtures/init-container/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | foo: 3 | image: alpine 4 | command: "echo hello" 5 | 6 | bar: 7 | image: alpine 8 | command: "echo world" 9 | depends_on: 10 | foo: 11 | condition: "service_completed_successfully" 12 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/ipam/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | foo: 3 | image: alpine 4 | init: true 5 | entrypoint: ["sleep", "600"] 6 | networks: 7 | default: 8 | ipv4_address: 10.1.0.100 # <-- Fixed IP address 9 | networks: 10 | default: 11 | ipam: 12 | config: 13 | - subnet: 10.1.0.0/16 14 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/ipc-test/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | service: 3 | image: alpine 4 | command: top 5 | ipc: "service:shareable" 6 | container: 7 | image: alpine 8 | command: top 9 | ipc: "container:ipc_mode_container" 10 | shareable: 11 | image: alpine 12 | command: top 13 | ipc: shareable 14 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/links/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | foo: 3 | image: nginx:alpine 4 | links: 5 | - bar 6 | 7 | bar: 8 | image: nginx:alpine 9 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/logging-driver/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | fluentbit: 3 | image: fluent/fluent-bit:3.1.7-debug 4 | ports: 5 | - "24224:24224" 6 | - "24224:24224/udp" 7 | environment: 8 | FOO: ${BAR} 9 | 10 | app: 11 | image: nginx 12 | depends_on: 13 | fluentbit: 14 | condition: service_started 15 | restart: true 16 | logging: 17 | driver: fluentd 18 | options: 19 | fluentd-address: ${HOST:-127.0.0.1}:24224 20 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/logs-test/cat.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | test: 3 | image: alpine 4 | command: cat /text_file.txt 5 | volumes: 6 | - ${FILE}:/text_file.txt 7 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/logs-test/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | ping: 3 | image: alpine 4 | init: true 5 | command: ping localhost -c ${REPEAT:-1} 6 | hello: 7 | image: alpine 8 | command: echo hello 9 | deploy: 10 | replicas: 2 11 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/logs-test/restart.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | ping: 3 | image: alpine 4 | command: "sh -c 'ping -c 2 localhost && exit 1'" 5 | restart: "on-failure:2" 6 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/nested/.env: -------------------------------------------------------------------------------- 1 | ROOT=root 2 | WIN=root -------------------------------------------------------------------------------- /pkg/e2e/fixtures/nested/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | echo: 3 | image: alpine 4 | command: echo $ROOT $SUB win=$WIN 5 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/nested/sub/.env: -------------------------------------------------------------------------------- 1 | SUB=sub 2 | WIN=sub 3 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/network-alias/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | 3 | container1: 4 | image: nginx 5 | links: 6 | - container2:container 7 | 8 | container2: 9 | image: nginx 10 | networks: 11 | default: 12 | aliases: 13 | - alias-of-container2 14 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/network-interface-name/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | test: 3 | image: alpine 4 | command: ip link show 5 | networks: 6 | default: 7 | interface_name: foobar 8 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/network-links/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | container1: 3 | image: nginx 4 | network_mode: bridge 5 | container2: 6 | image: nginx 7 | network_mode: bridge 8 | links: 9 | - container1 10 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/network-test/compose.subnet.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | test: 3 | image: nginx:alpine 4 | networks: 5 | - test 6 | 7 | networks: 8 | test: 9 | ipam: 10 | config: 11 | - subnet: ${SUBNET-172.99.0.0/16} 12 | 13 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/network-test/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | mydb: 3 | image: mariadb 4 | network_mode: "service:db" 5 | environment: 6 | - MYSQL_ALLOW_EMPTY_PASSWORD=yes 7 | db: 8 | image: gtardif/sentences-db 9 | init: true 10 | networks: 11 | - dbnet 12 | - closesnetworkname1 13 | - closesnetworkname2 14 | words: 15 | image: gtardif/sentences-api 16 | init: true 17 | ports: 18 | - "8080:8080" 19 | networks: 20 | - dbnet 21 | - servicenet 22 | web: 23 | image: gtardif/sentences-web 24 | init: true 25 | ports: 26 | - "80:80" 27 | labels: 28 | - "my-label=test" 29 | networks: 30 | - servicenet 31 | 32 | networks: 33 | dbnet: 34 | servicenet: 35 | name: microservices 36 | closesnetworkname1: 37 | name: closenamenet 38 | closesnetworkname2: 39 | name: closenamenet-2 40 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/network-test/mac_address.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | test: 3 | image: nginx:alpine 4 | mac_address: 00:e0:84:35:d0:e8 5 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/no-deps/network-mode.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | app: 3 | image: nginx:alpine 4 | network_mode: service:db 5 | 6 | db: 7 | image: nginx:alpine 8 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/no-deps/volume-from.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | app: 3 | image: nginx:alpine 4 | volumes_from: 5 | - db 6 | 7 | db: 8 | image: nginx:alpine 9 | volumes: 10 | - /var/data 11 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/orphans/.env: -------------------------------------------------------------------------------- 1 | COMPOSE_REMOVE_ORPHANS=true 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/orphans/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | orphan: 3 | profiles: [run] 4 | image: alpine 5 | command: echo hello 6 | test: 7 | image: nginx:alpine 8 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/pause/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | a: 3 | image: nginx:alpine 4 | ports: [80] 5 | healthcheck: 6 | test: wget --spider -S -T1 http://localhost:80 7 | interval: 1s 8 | timeout: 1s 9 | b: 10 | image: nginx:alpine 11 | ports: [80] 12 | depends_on: 13 | - a 14 | healthcheck: 15 | test: wget --spider -S -T1 http://localhost:80 16 | interval: 1s 17 | timeout: 1s 18 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/port-range/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | a: 3 | image: nginx:alpine 4 | scale: 5 5 | ports: 6 | - "6005-6015:80" 7 | 8 | b: 9 | image: nginx:alpine 10 | ports: 11 | - 80 12 | 13 | c: 14 | image: nginx:alpine 15 | ports: 16 | - 80 -------------------------------------------------------------------------------- /pkg/e2e/fixtures/profiles/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | regular-service: 3 | image: nginx:alpine 4 | 5 | profiled-service: 6 | image: nginx:alpine 7 | profiles: 8 | - test-profile -------------------------------------------------------------------------------- /pkg/e2e/fixtures/profiles/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | foo: 3 | container_name: foo_c 4 | profiles: [ test ] 5 | image: alpine 6 | depends_on: [ db ] 7 | 8 | bar: 9 | container_name: bar_c 10 | profiles: [ test ] 11 | image: alpine 12 | 13 | db: 14 | container_name: db_c 15 | image: alpine -------------------------------------------------------------------------------- /pkg/e2e/fixtures/profiles/test-profile.env: -------------------------------------------------------------------------------- 1 | COMPOSE_PROFILES=test-profile 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/project-volume-bind-test/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | frontend: 3 | image: nginx 4 | container_name: frontend 5 | volumes: 6 | - project-data:/data 7 | 8 | volumes: 9 | project-data: 10 | driver: local 11 | driver_opts: 12 | type: none 13 | o: bind 14 | device: "${TEST_DIR}" 15 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/ps-test/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | nginx: 3 | image: nginx:latest 4 | expose: 5 | - '80' 6 | - '443' 7 | - '8080' 8 | busybox: 9 | image: busybox 10 | command: busybox httpd -f -p 8000 11 | ports: 12 | - '127.0.0.1:8001:8000' 13 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/publish/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM alpine:latest -------------------------------------------------------------------------------- /pkg/e2e/fixtures/publish/common.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | foo: 3 | image: bar -------------------------------------------------------------------------------- /pkg/e2e/fixtures/publish/compose-bind-mount.yml: -------------------------------------------------------------------------------- 1 | services: 2 | serviceA: 3 | image: a 4 | volumes: 5 | - .:/user-data 6 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/publish/compose-build-only.yml: -------------------------------------------------------------------------------- 1 | services: 2 | serviceA: 3 | build: 4 | context: . 5 | dockerfile: Dockerfile 6 | serviceB: 7 | build: 8 | context: . 9 | dockerfile: Dockerfile 10 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/publish/compose-env-file.yml: -------------------------------------------------------------------------------- 1 | services: 2 | serviceA: 3 | image: "alpine:3.12" 4 | env_file: 5 | - publish.env 6 | serviceB: 7 | image: "alpine:3.12" 8 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/publish/compose-environment.yml: -------------------------------------------------------------------------------- 1 | services: 2 | serviceA: 3 | image: "alpine:3.12" 4 | environment: 5 | - "FOO=bar" 6 | serviceB: 7 | image: "alpine:3.12" 8 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/publish/compose-local-include.yml: -------------------------------------------------------------------------------- 1 | include: 2 | - common.yaml 3 | 4 | services: 5 | test: 6 | image: test -------------------------------------------------------------------------------- /pkg/e2e/fixtures/publish/compose-multi-env-config.yml: -------------------------------------------------------------------------------- 1 | services: 2 | serviceA: 3 | image: "alpine:3.12" 4 | environment: 5 | - "FOO=bar" 6 | serviceB: 7 | image: "alpine:3.12" 8 | env_file: 9 | - publish.env 10 | environment: 11 | - "BAR=baz" -------------------------------------------------------------------------------- /pkg/e2e/fixtures/publish/compose-sensitive.yml: -------------------------------------------------------------------------------- 1 | services: 2 | serviceA: 3 | image: "alpine:3.12" 4 | environment: 5 | - AWS_ACCESS_KEY_ID=A3TX1234567890ABCDEF 6 | - AWS_SECRET_ACCESS_KEY=aws"12345+67890/abcdefghijklm+NOPQRSTUVWXYZ+" 7 | configs: 8 | - myconfig 9 | serviceB: 10 | image: "alpine:3.12" 11 | env_file: 12 | - publish-sensitive.env 13 | secrets: 14 | - mysecret 15 | configs: 16 | myconfig: 17 | file: config.txt 18 | secrets: 19 | mysecret: 20 | file: secret.txt -------------------------------------------------------------------------------- /pkg/e2e/fixtures/publish/compose-with-extends.yml: -------------------------------------------------------------------------------- 1 | services: 2 | test: 3 | extends: 4 | file: common.yaml 5 | service: foo 6 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/publish/config.txt: -------------------------------------------------------------------------------- 1 | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw -------------------------------------------------------------------------------- /pkg/e2e/fixtures/publish/publish-sensitive.env: -------------------------------------------------------------------------------- 1 | GITHUB_TOKEN=ghp_1234567890abcdefghijklmnopqrstuvwxyz 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/publish/publish.env: -------------------------------------------------------------------------------- 1 | FOO=bar 2 | QUIX= -------------------------------------------------------------------------------- /pkg/e2e/fixtures/publish/secret.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PRIVATE KEY----- 2 | wxyz+ABC= 3 | -----END DSA PRIVATE KEY----- -------------------------------------------------------------------------------- /pkg/e2e/fixtures/recreate-volumes/bind.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | app: 3 | image: alpine 4 | volumes: 5 | - .:/my_vol 6 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/recreate-volumes/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | app: 3 | image: alpine 4 | volumes: 5 | - my_vol:/my_vol 6 | 7 | volumes: 8 | my_vol: 9 | labels: 10 | foo: bar 11 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/recreate-volumes/compose2.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | app: 3 | image: alpine 4 | volumes: 5 | - my_vol:/my_vol 6 | 7 | volumes: 8 | my_vol: 9 | labels: 10 | foo: zot 11 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/resources/compose.yaml: -------------------------------------------------------------------------------- 1 | volumes: 2 | my_vol: {} 3 | 4 | networks: 5 | my_net: {} -------------------------------------------------------------------------------- /pkg/e2e/fixtures/restart-test/compose-depends-on.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | with-restart: 3 | image: nginx:alpine 4 | init: true 5 | command: tail -f /dev/null 6 | depends_on: 7 | nginx: {condition: service_healthy, restart: true} 8 | 9 | no-restart: 10 | image: nginx:alpine 11 | init: true 12 | command: tail -f /dev/null 13 | depends_on: 14 | nginx: { condition: service_healthy } 15 | 16 | nginx: 17 | image: nginx:alpine 18 | labels: 19 | TEST: ${LABEL:-test} 20 | healthcheck: 21 | test: "echo | nc -w 5 localhost:80" 22 | interval: 2s 23 | timeout: 1s 24 | retries: 10 25 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/restart-test/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | restart: 3 | image: alpine 4 | init: true 5 | command: ash -c "if [[ -f /tmp/restart.lock ]] ; then sleep infinity; else touch /tmp/restart.lock; fi" 6 | 7 | test: 8 | profiles: 9 | - test 10 | image: alpine 11 | init: true 12 | command: ash -c "if [[ -f /tmp/restart.lock ]] ; then sleep infinity; else touch /tmp/restart.lock; fi" 13 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/run-test/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | back: 3 | image: alpine 4 | command: echo "Hello there!!" 5 | depends_on: 6 | - db 7 | networks: 8 | - backnet 9 | db: 10 | image: nginx:alpine 11 | networks: 12 | - backnet 13 | volumes: 14 | - data:/test 15 | front: 16 | image: nginx:alpine 17 | networks: 18 | - frontnet 19 | networks: 20 | frontnet: 21 | backnet: 22 | volumes: 23 | data: 24 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/run-test/deps.yaml: -------------------------------------------------------------------------------- 1 | version: "3.6" 2 | services: 3 | service_a: 4 | image: bash 5 | command: echo "a" 6 | depends_on: 7 | - shared_dep 8 | service_b: 9 | image: bash 10 | command: echo "b" 11 | depends_on: 12 | - shared_dep 13 | shared_dep: 14 | image: bash -------------------------------------------------------------------------------- /pkg/e2e/fixtures/run-test/orphan.yaml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | services: 3 | simple: 4 | image: alpine 5 | command: echo "Hi there!!" 6 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/run-test/ports.yaml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | services: 3 | back: 4 | image: alpine 5 | ports: 6 | - 8082:80 7 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/run-test/pull.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | backend: 3 | image: nginx 4 | command: nginx -t -------------------------------------------------------------------------------- /pkg/e2e/fixtures/run-test/quiet-pull.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | backend: 3 | image: hello-world -------------------------------------------------------------------------------- /pkg/e2e/fixtures/run-test/run.env: -------------------------------------------------------------------------------- 1 | FOO=BAR 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/scale/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM nginx:alpine 16 | ARG FOO 17 | LABEL FOO=$FOO -------------------------------------------------------------------------------- /pkg/e2e/fixtures/scale/build.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | test: 3 | build: . 4 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/scale/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | back: 3 | image: nginx:alpine 4 | depends_on: 5 | - db 6 | db: 7 | image: nginx:alpine 8 | environment: 9 | - MAYBE 10 | front: 11 | image: nginx:alpine 12 | deploy: 13 | replicas: 2 14 | dbadmin: 15 | image: nginx:alpine 16 | deploy: 17 | replicas: 0 -------------------------------------------------------------------------------- /pkg/e2e/fixtures/sentences/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | db: 3 | image: gtardif/sentences-db 4 | init: true 5 | words: 6 | image: gtardif/sentences-api 7 | init: true 8 | ports: 9 | - "95:8080" 10 | web: 11 | image: gtardif/sentences-web 12 | init: true 13 | ports: 14 | - "90:80" 15 | labels: 16 | - "my-label=test" 17 | healthcheck: 18 | test: ["CMD", "curl", "-f", "http://localhost:80/"] 19 | interval: 2s 20 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/simple-build-test/compose-interpolate.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | nginx: 3 | build: 4 | context: nginx-build 5 | dockerfile: ${MYVAR} 6 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/simple-build-test/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | nginx: 3 | build: 4 | context: nginx-build 5 | dockerfile: Dockerfile 6 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/simple-build-test/nginx-build/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM nginx:alpine 16 | 17 | ARG FOO 18 | LABEL FOO=$FOO 19 | COPY static /usr/share/nginx/html 20 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/simple-build-test/nginx-build/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Docker Nginx 6 | 7 | 8 |

Hello from Nginx container

9 | 10 | 11 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/simple-composefile/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | simple: 3 | image: alpine 4 | command: top 5 | another: 6 | image: alpine 7 | command: top 8 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/simple-composefile/id.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | test: 3 | image: ${ID:?ID variable must be set} 4 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/start-fail/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | fail: 3 | image: alpine 4 | init: true 5 | command: sleep infinity 6 | healthcheck: 7 | test: "false" 8 | interval: 1s 9 | retries: 3 10 | depends: 11 | image: alpine 12 | init: true 13 | command: sleep infinity 14 | depends_on: 15 | fail: 16 | condition: service_healthy 17 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/start-fail/start-depends_on-long-lived.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | safe: 3 | image: 'alpine' 4 | init: true 5 | command: ['/bin/sh', '-c', 'sleep infinity'] # never exiting 6 | failure: 7 | image: 'alpine' 8 | init: true 9 | command: ['/bin/sh', '-c', 'sleep 1 ; echo "exiting with error" ; exit 42'] 10 | test: 11 | image: 'alpine' 12 | init: true 13 | command: ['/bin/sh', '-c', 'sleep 99999 ; echo "tests are OK"'] # very long job 14 | depends_on: [safe] 15 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/start-stop/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | simple: 3 | image: nginx:alpine 4 | another: 5 | image: nginx:alpine 6 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/start-stop/other.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | a-different-one: 3 | image: nginx:alpine 4 | and-another-one: 5 | image: nginx:alpine 6 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/start-stop/start-stop-deps.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | another_2: 3 | image: nginx:alpine 4 | another: 5 | image: nginx:alpine 6 | depends_on: 7 | - another_2 8 | dep_2: 9 | image: nginx:alpine 10 | dep_1: 11 | image: nginx:alpine 12 | depends_on: 13 | - dep_2 14 | desired: 15 | image: nginx:alpine 16 | depends_on: 17 | - dep_1 18 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/start_interval/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | test: 3 | image: "nginx" 4 | healthcheck: 5 | interval: 30s 6 | start_period: 10s 7 | start_interval: 1s 8 | test: "/bin/true" 9 | 10 | error: 11 | image: "nginx" 12 | healthcheck: 13 | interval: 30s 14 | start_interval: 1s 15 | test: "/bin/true" -------------------------------------------------------------------------------- /pkg/e2e/fixtures/stdout-stderr/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | stderr: 3 | image: alpine 4 | init: true 5 | command: /bin/ash /log_to_stderr.sh 6 | volumes: 7 | - ./log_to_stderr.sh:/log_to_stderr.sh 8 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/stdout-stderr/log_to_stderr.sh: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | >&2 echo "log to stderr" 16 | echo "log to stdout" 17 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/switch-volumes/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | app: 3 | image: alpine 4 | volumes: 5 | - my_vol:/my_vol 6 | 7 | volumes: 8 | my_vol: 9 | external: true 10 | name: test_external_volume 11 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/switch-volumes/compose2.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | app: 3 | image: alpine 4 | volumes: 5 | - my_vol:/my_vol 6 | 7 | volumes: 8 | my_vol: 9 | external: true 10 | name: test_external_volume_2 11 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/ups-deps-stop/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | dependency: 3 | image: alpine 4 | init: true 5 | command: /bin/sh -c 'while true; do echo "hello dependency"; sleep 1; done' 6 | 7 | app: 8 | depends_on: ['dependency'] 9 | image: alpine 10 | init: true 11 | command: /bin/sh -c 'while true; do echo "hello app"; sleep 1; done' 12 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/ups-deps-stop/orphan.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | orphan: 3 | image: alpine 4 | init: true 5 | command: /bin/sh -c 'while true; do echo "hello orphan"; sleep 1; done' 6 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/volume-test/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | nginx: 3 | build: nginx-build 4 | volumes: 5 | - ./static:/usr/share/nginx/html 6 | ports: 7 | - 8090:80 8 | 9 | nginx2: 10 | build: nginx-build 11 | volumes: 12 | - staticVol:/usr/share/nginx/html:ro 13 | - /usr/src/app/node_modules 14 | - otherVol:/usr/share/nginx/test 15 | ports: 16 | - 9090:80 17 | configs: 18 | - myconfig 19 | secrets: 20 | - mysecret 21 | 22 | volumes: 23 | staticVol: 24 | otherVol: 25 | name: myVolume 26 | 27 | configs: 28 | myconfig: 29 | file: ./static/index.html 30 | 31 | secrets: 32 | mysecret: 33 | file: ./static/index.html -------------------------------------------------------------------------------- /pkg/e2e/fixtures/volume-test/nginx-build/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM nginx:alpine 16 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/volume-test/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Docker Nginx 6 | 7 | 8 |

Hello from Nginx container

9 | 10 | 11 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/volumes/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | with_image: 3 | image: alpine 4 | command: "ls -al /mnt/image" 5 | volumes: 6 | - type: image 7 | source: nginx:alpine 8 | target: /mnt/image 9 | image: 10 | subpath: usr/share/nginx/html/ -------------------------------------------------------------------------------- /pkg/e2e/fixtures/wait/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | faster: 3 | image: alpine 4 | command: sleep 2 5 | slower: 6 | image: alpine 7 | command: sleep 5 8 | infinity: 9 | image: alpine 10 | command: sleep infinity 11 | 12 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/watch/compose.yaml: -------------------------------------------------------------------------------- 1 | x-dev: &x-dev 2 | watch: 3 | - action: sync 4 | path: ./data 5 | target: /app/data 6 | ignore: 7 | - '*.foo' 8 | - ./ignored 9 | - action: sync+restart 10 | path: ./config 11 | target: /app/config 12 | 13 | services: 14 | alpine: 15 | build: 16 | dockerfile_inline: |- 17 | FROM alpine 18 | RUN mkdir -p /app/data 19 | RUN mkdir -p /app/config 20 | init: true 21 | command: sleep infinity 22 | develop: *x-dev 23 | busybox: 24 | build: 25 | dockerfile_inline: |- 26 | FROM busybox 27 | RUN mkdir -p /app/data 28 | RUN mkdir -p /app/config 29 | init: true 30 | command: sleep infinity 31 | develop: *x-dev 32 | debian: 33 | build: 34 | dockerfile_inline: |- 35 | FROM debian 36 | RUN mkdir -p /app/data 37 | RUN mkdir -p /app/config 38 | init: true 39 | command: sleep infinity 40 | volumes: 41 | - ./dat:/app/dat 42 | - ./data-logs:/app/data-logs 43 | develop: *x-dev 44 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/watch/config/file.config: -------------------------------------------------------------------------------- 1 | This is a config file 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/watch/dat/meow.dat: -------------------------------------------------------------------------------- 1 | i am a wannabe cat 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/watch/data-logs/server.log: -------------------------------------------------------------------------------- 1 | [INFO] Server started successfully on port 8080 2 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/watch/data/hello.txt: -------------------------------------------------------------------------------- 1 | hello world -------------------------------------------------------------------------------- /pkg/e2e/fixtures/watch/exec.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | test: 3 | build: 4 | dockerfile_inline: FROM alpine 5 | command: ping localhost 6 | volumes: 7 | - /data 8 | develop: 9 | watch: 10 | - path: . 11 | target: /data 12 | action: sync+exec 13 | exec: 14 | command: echo "SUCCESS" -------------------------------------------------------------------------------- /pkg/e2e/fixtures/watch/include.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | a: 3 | build: 4 | dockerfile_inline: | 5 | FROM nginx 6 | RUN mkdir /data/ 7 | develop: 8 | watch: 9 | - path: . 10 | include: A.* 11 | target: /data/ 12 | action: sync 13 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/watch/rebuild.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | a: 3 | build: 4 | dockerfile_inline: | 5 | FROM nginx 6 | RUN mkdir /data 7 | COPY test /data/a 8 | develop: 9 | watch: 10 | - path: test 11 | action: rebuild 12 | b: 13 | build: 14 | dockerfile_inline: | 15 | FROM nginx 16 | RUN mkdir /data 17 | COPY test /data/b 18 | develop: 19 | watch: 20 | - path: test 21 | action: rebuild 22 | c: 23 | build: 24 | dockerfile_inline: | 25 | FROM nginx 26 | RUN mkdir /data 27 | COPY test /data/c 28 | develop: 29 | watch: 30 | - path: test 31 | action: rebuild 32 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/watch/with-external-network.yaml: -------------------------------------------------------------------------------- 1 | 2 | services: 3 | ext-alpine: 4 | build: 5 | dockerfile_inline: |- 6 | FROM alpine 7 | init: true 8 | command: sleep infinity 9 | develop: 10 | watch: 11 | - action: rebuild 12 | path: .env 13 | networks: 14 | - external_network_test 15 | 16 | networks: 17 | external_network_test: 18 | name: e2e-watch-external_network_test 19 | external: true 20 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/wrong-composefile/build-error.yml: -------------------------------------------------------------------------------- 1 | services: 2 | simple: 3 | build: service1 4 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/wrong-composefile/compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | simple: 3 | image: nginx:alpine 4 | wrongField: test 5 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/wrong-composefile/service1/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Docker Compose CLI authors 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM nginx 16 | 17 | WRONG DOCKERFILE 18 | -------------------------------------------------------------------------------- /pkg/e2e/fixtures/wrong-composefile/unknown-image.yml: -------------------------------------------------------------------------------- 1 | services: 2 | simple: 3 | image: unknownimage 4 | -------------------------------------------------------------------------------- /pkg/e2e/main_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package e2e 18 | 19 | import ( 20 | "os" 21 | "testing" 22 | ) 23 | 24 | func TestMain(m *testing.M) { 25 | exitCode := m.Run() 26 | os.Exit(exitCode) 27 | } 28 | -------------------------------------------------------------------------------- /pkg/e2e/orphans_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package e2e 18 | 19 | import ( 20 | "strings" 21 | "testing" 22 | 23 | "gotest.tools/v3/assert" 24 | ) 25 | 26 | func TestRemoveOrphans(t *testing.T) { 27 | c := NewCLI(t) 28 | 29 | const projectName = "compose-e2e-orphans" 30 | defer c.cleanupWithDown(t, projectName) 31 | 32 | c.RunDockerComposeCmd(t, "-f", "./fixtures/orphans/compose.yaml", "-p", projectName, "run", "orphan") 33 | res := c.RunDockerComposeCmd(t, "-p", projectName, "ps", "--all") 34 | assert.Check(t, strings.Contains(res.Combined(), "compose-e2e-orphans-orphan-run-")) 35 | 36 | c.RunDockerComposeCmd(t, "-f", "./fixtures/orphans/compose.yaml", "-p", projectName, "up", "-d") 37 | 38 | res = c.RunDockerComposeCmd(t, "-p", projectName, "ps", "--all") 39 | assert.Check(t, !strings.Contains(res.Combined(), "compose-e2e-orphans-orphan-run-")) 40 | } 41 | -------------------------------------------------------------------------------- /pkg/e2e/recreate_no_deps_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package e2e 18 | 19 | import ( 20 | "testing" 21 | 22 | "gotest.tools/v3/icmd" 23 | ) 24 | 25 | func TestRecreateWithNoDeps(t *testing.T) { 26 | c := NewParallelCLI(t, WithEnv( 27 | "COMPOSE_PROJECT_NAME=recreate-no-deps", 28 | )) 29 | 30 | res := c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/dependencies/recreate-no-deps.yaml", "up", "-d") 31 | res.Assert(t, icmd.Success) 32 | 33 | res = c.RunDockerComposeCmdNoCheck(t, "-f", "fixtures/dependencies/recreate-no-deps.yaml", "up", "-d", "--force-recreate", "--no-deps", "my-service") 34 | res.Assert(t, icmd.Success) 35 | 36 | RequireServiceState(t, c, "my-service", "running") 37 | 38 | c.RunDockerComposeCmd(t, "down") 39 | } 40 | -------------------------------------------------------------------------------- /pkg/progress/colors.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package progress 18 | 19 | import ( 20 | "github.com/morikuni/aec" 21 | ) 22 | 23 | type colorFunc func(string) string 24 | 25 | var ( 26 | nocolor colorFunc = func(s string) string { 27 | return s 28 | } 29 | 30 | DoneColor colorFunc = aec.BlueF.Apply 31 | TimerColor colorFunc = aec.BlueF.Apply 32 | CountColor colorFunc = aec.YellowF.Apply 33 | WarningColor colorFunc = aec.YellowF.With(aec.Bold).Apply 34 | SuccessColor colorFunc = aec.GreenF.Apply 35 | ErrorColor colorFunc = aec.RedF.With(aec.Bold).Apply 36 | PrefixColor colorFunc = aec.CyanF.Apply 37 | ) 38 | 39 | func NoColor() { 40 | DoneColor = nocolor 41 | TimerColor = nocolor 42 | CountColor = nocolor 43 | WarningColor = nocolor 44 | SuccessColor = nocolor 45 | ErrorColor = nocolor 46 | PrefixColor = nocolor 47 | } 48 | -------------------------------------------------------------------------------- /pkg/progress/noop.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package progress 18 | 19 | import ( 20 | "context" 21 | ) 22 | 23 | type noopWriter struct{} 24 | 25 | func (p *noopWriter) Start(ctx context.Context) error { 26 | return nil 27 | } 28 | 29 | func (p *noopWriter) Event(Event) { 30 | } 31 | 32 | func (p *noopWriter) Events([]Event) { 33 | } 34 | 35 | func (p *noopWriter) TailMsgf(_ string, _ ...interface{}) { 36 | } 37 | 38 | func (p *noopWriter) Stop() { 39 | } 40 | -------------------------------------------------------------------------------- /pkg/progress/quiet.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package progress 18 | 19 | import "context" 20 | 21 | type quiet struct{} 22 | 23 | func (q quiet) Start(_ context.Context) error { 24 | return nil 25 | } 26 | 27 | func (q quiet) Stop() { 28 | } 29 | 30 | func (q quiet) Event(_ Event) { 31 | } 32 | 33 | func (q quiet) Events(_ []Event) { 34 | } 35 | 36 | func (q quiet) TailMsgf(_ string, _ ...interface{}) { 37 | } 38 | -------------------------------------------------------------------------------- /pkg/progress/writer_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package progress 18 | 19 | import ( 20 | "context" 21 | "testing" 22 | 23 | "gotest.tools/v3/assert" 24 | ) 25 | 26 | func TestNoopWriter(t *testing.T) { 27 | todo := context.TODO() 28 | writer := ContextWriter(todo) 29 | 30 | assert.Equal(t, writer, &noopWriter{}) 31 | } 32 | -------------------------------------------------------------------------------- /pkg/remote/cache.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package remote 18 | 19 | import ( 20 | "os" 21 | "path/filepath" 22 | ) 23 | 24 | func cacheDir() (string, error) { 25 | cache, ok := os.LookupEnv("XDG_CACHE_HOME") 26 | if ok { 27 | return filepath.Join(cache, "docker-compose"), nil 28 | } 29 | 30 | path, err := osDependentCacheDir() 31 | if err != nil { 32 | return "", err 33 | } 34 | err = os.MkdirAll(path, 0o700) 35 | return path, err 36 | } 37 | -------------------------------------------------------------------------------- /pkg/remote/cache_darwin.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package remote 18 | 19 | import ( 20 | "os" 21 | "path/filepath" 22 | ) 23 | 24 | // Based on https://github.com/adrg/xdg 25 | // Licensed under MIT License (MIT) 26 | // Copyright (c) 2014 Adrian-George Bostan 27 | 28 | func osDependentCacheDir() (string, error) { 29 | home, err := os.UserHomeDir() 30 | if err != nil { 31 | return "", err 32 | } 33 | return filepath.Join(home, "Library", "Caches", "docker-compose"), nil 34 | } 35 | -------------------------------------------------------------------------------- /pkg/remote/cache_unix.go: -------------------------------------------------------------------------------- 1 | //go:build linux || openbsd 2 | 3 | /* 4 | Copyright 2020 Docker Compose CLI authors 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package remote 20 | 21 | import ( 22 | "os" 23 | "path/filepath" 24 | ) 25 | 26 | // Based on https://github.com/adrg/xdg 27 | // Licensed under MIT License (MIT) 28 | // Copyright (c) 2014 Adrian-George Bostan 29 | 30 | func osDependentCacheDir() (string, error) { 31 | home, err := os.UserHomeDir() 32 | if err != nil { 33 | return "", err 34 | } 35 | return filepath.Join(home, ".cache", "docker-compose"), nil 36 | } 37 | -------------------------------------------------------------------------------- /pkg/utils/durationutils.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package utils 18 | 19 | import "time" 20 | 21 | func DurationSecondToInt(d *time.Duration) *int { 22 | if d == nil { 23 | return nil 24 | } 25 | timeout := int(d.Seconds()) 26 | return &timeout 27 | } 28 | -------------------------------------------------------------------------------- /pkg/utils/set_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, 10 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | See the License for the specific language governing permissions and 12 | limitations under the License. 13 | */ 14 | 15 | package utils 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/stretchr/testify/require" 21 | ) 22 | 23 | func TestSet_Has(t *testing.T) { 24 | x := NewSet[string]("value") 25 | require.True(t, x.Has("value")) 26 | require.False(t, x.Has("VALUE")) 27 | } 28 | 29 | func TestSet_Diff(t *testing.T) { 30 | a := NewSet[int](1, 2) 31 | b := NewSet[int](2, 3) 32 | require.ElementsMatch(t, []int{1}, a.Diff(b).Elements()) 33 | require.ElementsMatch(t, []int{3}, b.Diff(a).Elements()) 34 | } 35 | 36 | func TestSet_Union(t *testing.T) { 37 | a := NewSet[int](1, 2) 38 | b := NewSet[int](2, 3) 39 | require.ElementsMatch(t, []int{1, 2, 3}, a.Union(b).Elements()) 40 | require.ElementsMatch(t, []int{1, 2, 3}, b.Union(a).Elements()) 41 | } 42 | -------------------------------------------------------------------------------- /pkg/utils/stringutils.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package utils 18 | 19 | import ( 20 | "strconv" 21 | "strings" 22 | ) 23 | 24 | // StringToBool converts a string to a boolean ignoring errors 25 | func StringToBool(s string) bool { 26 | s = strings.ToLower(strings.TrimSpace(s)) 27 | if s == "y" { 28 | return true 29 | } 30 | b, _ := strconv.ParseBool(s) 31 | return b 32 | } 33 | -------------------------------------------------------------------------------- /pkg/utils/writer_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package utils 18 | 19 | import ( 20 | "testing" 21 | 22 | "gotest.tools/v3/assert" 23 | ) 24 | 25 | //nolint:errcheck 26 | func TestSplitWriter(t *testing.T) { 27 | var lines []string 28 | w := GetWriter(func(line string) { 29 | lines = append(lines, line) 30 | }) 31 | w.Write([]byte("h")) 32 | w.Write([]byte("e")) 33 | w.Write([]byte("l")) 34 | w.Write([]byte("l")) 35 | w.Write([]byte("o")) 36 | w.Write([]byte("\n")) 37 | w.Write([]byte("world!\n")) 38 | assert.DeepEqual(t, lines, []string{"hello", "world!"}) 39 | } 40 | -------------------------------------------------------------------------------- /pkg/watch/paths.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package watch 18 | 19 | import ( 20 | "fmt" 21 | "os" 22 | "path/filepath" 23 | ) 24 | 25 | func greatestExistingAncestor(path string) (string, error) { 26 | if path == string(filepath.Separator) || 27 | path == fmt.Sprintf("%s%s", filepath.VolumeName(path), string(filepath.Separator)) { 28 | return "", fmt.Errorf("cannot watch root directory") 29 | } 30 | 31 | _, err := os.Stat(path) 32 | if err != nil && !os.IsNotExist(err) { 33 | return "", fmt.Errorf("os.Stat(%q): %w", path, err) 34 | } 35 | 36 | if os.IsNotExist(err) { 37 | return greatestExistingAncestor(filepath.Dir(path)) 38 | } 39 | 40 | return path, nil 41 | } 42 | -------------------------------------------------------------------------------- /pkg/watch/paths_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 Docker Compose CLI authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package watch 18 | 19 | import ( 20 | "runtime" 21 | "testing" 22 | 23 | "github.com/stretchr/testify/assert" 24 | "github.com/stretchr/testify/require" 25 | ) 26 | 27 | func TestGreatestExistingAncestor(t *testing.T) { 28 | f := NewTempDirFixture(t) 29 | 30 | p, err := greatestExistingAncestor(f.Path()) 31 | require.NoError(t, err) 32 | assert.Equal(t, f.Path(), p) 33 | 34 | p, err = greatestExistingAncestor(f.JoinPath("missing")) 35 | require.NoError(t, err) 36 | assert.Equal(t, f.Path(), p) 37 | 38 | missingTopLevel := "/missingDir/a/b/c" 39 | if runtime.GOOS == "windows" { 40 | missingTopLevel = "C:\\missingDir\\a\\b\\c" 41 | } 42 | _, err = greatestExistingAncestor(missingTopLevel) 43 | assert.Contains(t, err.Error(), "cannot watch root directory") 44 | } 45 | -------------------------------------------------------------------------------- /pkg/watch/watcher_nonwin.go: -------------------------------------------------------------------------------- 1 | //go:build !windows 2 | // +build !windows 3 | 4 | /* 5 | Copyright 2020 Docker Compose CLI authors 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | */ 19 | 20 | package watch 21 | 22 | import "github.com/tilt-dev/fsnotify" 23 | 24 | func MaybeIncreaseBufferSize(w *fsnotify.Watcher) { 25 | // Not needed on non-windows 26 | } 27 | -------------------------------------------------------------------------------- /pkg/watch/watcher_windows.go: -------------------------------------------------------------------------------- 1 | //go:build windows 2 | // +build windows 3 | 4 | /* 5 | Copyright 2020 Docker Compose CLI authors 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | */ 19 | 20 | package watch 21 | 22 | import ( 23 | "github.com/tilt-dev/fsnotify" 24 | ) 25 | 26 | // TODO(nick): I think the ideal API would be to automatically increase the 27 | // size of the buffer when we exceed capacity. But this gets messy, 28 | // because each time we get a short read error, we need to invalidate 29 | // everything we know about the currently changed files. So for now, 30 | // we just provide a way for people to increase the buffer ourselves. 31 | // 32 | // It might also pay to be clever about sizing the buffer 33 | // relative the number of files in the directory we're watching. 34 | func MaybeIncreaseBufferSize(w *fsnotify.Watcher) { 35 | w.SetBufferSize(DesiredWindowsBufferSize()) 36 | } 37 | --------------------------------------------------------------------------------