Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "Supply a pre-built image with score-compose"
description: "Supply a pre-built image with score-compose"
headless: true
toc_hide: true
---

```bash
score-compose generate score.yaml --image my-registry/hello-world:1.0.0
```
10 changes: 10 additions & 0 deletions content/en/docs/How to/included/build-supply-image-score-k8s.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "Supply a pre-built image with score-k8s"
description: "Supply a pre-built image with score-k8s"
headless: true
toc_hide: true
---

```bash
score-k8s generate score.yaml --image my-registry/hello-world:1.0.0
```
29 changes: 29 additions & 0 deletions content/en/docs/How to/overrides.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,32 @@ Set the path of the property to an empty value to remove the property.
{{< tab name="score-compose" include="./included/overrides-property-empty-score-compose.md" />}}
{{< tab name="score-k8s" include="./included/overrides-property-empty-score-k8s.md" />}}
{{< /tabs >}}

## Build or supply a container image

When you run `score-compose generate` or `score-k8s generate`, each workload needs a container image. You can supply a pre-built image, or, with `score-compose`, build one from local source.

### How to supply a pre-built image

The value provided to the `--image` flag overrides the `image` field of any workload that lacks an explicit image definition in its Score file. To handle different images for multiple workloads, use the `--override-property` flag shown in [How to override a property](#how-to-override-a-property).

{{< tabs name="image-flag">}}
{{< tab name="score-compose" include="./included/build-supply-image-score-compose.md" />}}
{{< tab name="score-k8s" include="./included/build-supply-image-score-k8s.md" />}}
{{< /tabs >}}

### How to build a container image

Specific to `score-compose generate`, the `--build` flag specifies an optional build context to use for the given container. The format is either `--build=CONTAINER=./dir` or `--build=CONTAINER={"context":"./dir"}`.

The following example builds the `hello-world` container from the current directory:

```bash
score-compose generate score.yaml --build 'hello-world={"context":"."}'
```

Run `docker compose up` with the `--build` flag so Docker builds the image before it starts the containers:

```bash
docker compose up --build -d
```