You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compose Bridge lets you transform your Compose configuration file into configuration files for different platforms, primarily focusing on Kubernetes. The default transformation generates Kubernetes manifests and a Kustomize overlay which are designed for deployment on Docker Desktop with Kubernetes enabled.
11
+
Compose Bridge converts your Docker Compose configuration into platform-specific formats—primarily Kubernetes manifests. The default transformation generates Kubernetes manifests and a Kustomize overlay which are designed for deployment on Docker Desktop with Kubernetes enabled.
12
12
13
13
It's a flexible tool that lets you either take advantage of the [default transformation](usage.md) or [create a custom transformation](customize.md) to suit specific project needs and requirements.
Copy file name to clipboardExpand all lines: content/manuals/compose/bridge/customize.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,25 +2,26 @@
2
2
title: Customize Compose Bridge
3
3
linkTitle: Customize
4
4
weight: 20
5
-
description: Learn about the Compose Bridge templates syntax
6
-
keywords: compose, bridge, templates
5
+
description: Learn how to customize Compose Bridge transformations using Go templates and Compose extensions
6
+
keywords: docker compose bridge, customize compose bridge, compose bridge templates, compose to kubernetes, compose bridge transformation, go templates docker
7
+
7
8
---
8
9
9
10
{{< summary-bar feature_name="Compose bridge" >}}
10
11
11
-
This page explains how Compose Bridge utilizes templating to efficiently translate Docker Compose files into Kubernetes manifests. It also explain how you can customize these templates for your specific requirements and needs, or how you can build your own transformation.
12
+
This page explains how Compose Bridge utilizes templating to efficiently translate Docker Compose files into Kubernetes manifests. It also explains how you can customize these templates for your specific requirements and needs, or how you can build your own transformation.
12
13
13
14
## How it works
14
15
15
16
Compose bridge uses transformations to let you convert a Compose model into another form.
16
17
17
18
A transformation is packaged as a Docker image that receives the fully-resolved Compose model as `/in/compose.yaml` and can produce any target format file under `/out`.
18
19
19
-
Compose Bridge provides its transformation for Kubernetes using Go templates, so that it is easy to extend for customization by just replacing or appending your own templates.
20
+
Compose Bridge includes a default Kubernetes transformation using Go templates, which you can customize by replacing or extending templates.
20
21
21
22
### Syntax
22
23
23
-
Compose Bridge make use of templates to transform a Compose configuration file into Kubernetes manifests. Templates are plain text files that use the [Go templating syntax](https://pkg.go.dev/text/template). This enables the insertion of logic and data, making the templates dynamic and adaptable according to the Compose model.
24
+
Compose Bridge makes use of templates to transform a Compose configuration file into Kubernetes manifests. Templates are plain text files that use the [Go templating syntax](https://pkg.go.dev/text/template). This enables the insertion of logic and data, making the templates dynamic and adaptable according to the Compose model.
24
25
25
26
When a template is executed, it must produce a YAML file which is the standard format for Kubernetes manifests. Multiple files can be generated as long as they are separated by `---`
26
27
@@ -44,7 +45,7 @@ key: value
44
45
45
46
### Input
46
47
47
-
The input Compose model is the canonical YAML model you can get by running `docker compose config`. Within the templates, data from the `compose.yaml` is accessed using dot notation, allowing you to navigate through nested data structures. For example, to access the deployment mode of a service, you would use `service.deploy.mode`:
48
+
You can generate the input model by running `docker compose config`. This canonical YAML output serves as the input for Compose Bridge transformations. Within the templates, data from the `compose.yaml` is accessed using dot notation, allowing you to navigate through nested data structures. For example, to access the deployment mode of a service, you would use `service.deploy.mode`:
48
49
49
50
```yaml
50
51
# iterate over a yaml sequence
@@ -86,7 +87,7 @@ In the following example, the template checks if a healthcheck interval is speci
86
87
As Kubernetes is a versatile platform, there are many ways
87
88
to map Compose concepts into Kubernetes resource definitions. Compose
88
89
Bridge lets you customize the transformation to match your own infrastructure
89
-
decisions and preferences, with various level of flexibility and effort.
90
+
decisions and preferences, with varying level of flexibility and effort.
Copy file name to clipboardExpand all lines: content/manuals/compose/bridge/usage.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,13 @@
2
2
title: Use the default Compose Bridge transformation
3
3
linkTitle: Usage
4
4
weight: 10
5
-
description: Learn about and use the Compose Bridge default transformation
6
-
keywords: compose, bridge, kubernetes
5
+
description: Learn how to use the default Compose Bridge transformation to convert Compose files into Kubernetes manifests
6
+
keywords: docker compose bridge, compose kubernetes transform, kubernetes from compose, compose bridge convert, compose.yaml to kubernetes
7
7
---
8
8
9
9
{{< summary-bar feature_name="Compose bridge" >}}
10
10
11
-
Compose Bridge supplies an out-of-thebox transformation for your Compose configuration file. Based on an arbitrary `compose.yaml` file, Compose Bridge produces:
11
+
Compose Bridge supplies an out-of-the-box transformation for your Compose configuration file. Based on an arbitrary `compose.yaml` file, Compose Bridge produces:
12
12
13
13
- A [Namespace](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/) so all your resources are isolated and don't conflict with resources from other deployments.
14
14
- A [ConfigMap](https://kubernetes.io/docs/concepts/configuration/configmap/) with an entry for each and every [config](/reference/compose-file/configs.md) resource in your Compose application.
@@ -34,7 +34,8 @@ $ docker compose bridge convert
34
34
35
35
Compose looks for a `compose.yaml` file inside the current directory and then converts it.
36
36
37
-
The following output is displayed
37
+
When successful, Compose Bridge generates Kubernetes manifests and logs output similar to the following:
38
+
38
39
```console
39
40
$ docker compose bridge convert -f compose.yaml
40
41
Kubernetes resource api-deployment.yaml created
@@ -62,7 +63,7 @@ These files are then stored within your project in the `/out` folder.
62
63
The Kubernetes manifests can then be used to run the application on Kubernetes using
63
64
the standard deployment command `kubectl apply -k out/overlays/desktop/`.
64
65
65
-
> [!NOTE]
66
+
> [!IMPORTANT]
66
67
>
67
68
> Make sure you have enabled Kubernetes in Docker Desktop before you deploy your Compose Bridge transformations.
> You can now convert and deploy your Compose project to a Kubernetes cluster from the Compose file viewer.
84
+
> You can convert and deploy your Compose project to a Kubernetes cluster from the Compose file viewer.
84
85
>
85
86
> Make sure you are signed in to your Docker account, navigate to your container in the **Containers** view, and in the top-right corner select **View configurations** and then **Convert and Deploy to Kubernetes**.
By leveraging environment variables and interpolation in Docker Compose, you can create versatile and reusableconfigurations, making your Dockerized applications easier to manage and deploy across different environments.
11
+
Environment variables and interpolation in Docker Compose help you create reusable, flexible configurations. This makes Dockerized applications easier to manage and deploy across environments.
Copy file name to clipboardExpand all lines: content/manuals/compose/how-tos/environment-variables/envvars-precedence.md
+26-21Lines changed: 26 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ aliases:
12
12
13
13
When the same environment variable is set in multiple sources, Docker Compose follows a precedence rule to determine the value for that variable in your container's environment.
14
14
15
-
This page contains information on the level of precedence each method of setting environmental variables takes.
15
+
This page explains how Docker Compose determines the final value of an environment variable when it's defined in multiple locations.
16
16
17
17
The order of precedence (highest to lowest) is as follows:
18
18
1. Set using [`docker compose run -e` in the CLI](set-environment-variables.md#set-environment-variables-with-docker-compose-run---env).
@@ -59,25 +59,25 @@ The columns `Host OS environment` and `.env` file is listed only for illustratio
59
59
60
60
Each row represents a combination of contexts where `VALUE` is set, substituted, or both. The **Result** column indicates the final value for `VALUE` in each scenario.
Result 1: The local environment takes precedence, but the Compose file is not set to replicate this inside the container, so no such variable is set.
83
83
@@ -87,7 +87,7 @@ Result 3: The `environment` attribute in the Compose file defines an explicit va
87
87
88
88
Result 4: The image's `ENV` directive declares the variable `VALUE`, and since the Compose file is not set to override this value, this variable is defined by image
89
89
90
-
Result 5: The `docker compose run` command has the `--env` flag set which an explicit value, and overrides the value set by the image.
90
+
Result 5: The `docker compose run` command has the `--env` flag set with an explicit value, and overrides the value set by the image.
91
91
92
92
Result 6: The `docker compose run` command has the `--env` flag set to replicate the value from the environment. Host OS value takes precedence and is replicated into the container's environment.
93
93
@@ -104,3 +104,8 @@ Result 11: The `environment` attribute in the Compose file is set to replicate `
104
104
Result 12: The `--env` flag has higher precedence than the `environment` and `env_file` attributes and is to set to replicate `VALUE` from the local environment. Host OS value takes precedence and is replicated into the container's environment.
105
105
106
106
Results 13 to 15: The `--env` flag has higher precedence than the `environment` and `env_file` attributes and so sets the value.
107
+
108
+
## Next steps
109
+
110
+
-[Set environment variables in Compose](set-environment-variables.md)
111
+
-[Use variable interpolation in Compose files](variable-interpolation.md)
0 commit comments