Aspire do prepare-compose + aspire do push generate different tags
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Discussed in https://github.com/dotnet/aspire/discussions/14525
Originally posted by **thomasreuvers** February 17, 2026
I'm using `aspire do prepare-compose` to generate my `docker-compose.yaml` with the correct credentials and image tags, then `aspire do push` to push images to a self-hosted GitLab container registry. The push works fine, but `prepare-compose` ignores my custom tag and instead generates datetime-based tags like `20262058`. This means when I run `docker compose up`, it tries to pull images that don't exist in the registry.
Here's my setup:
```csharp
var builder = DistributedApplication.CreateBuilder(args);
var imageTag = Environment.GetEnvironmentVariable("IMAGE_TAG") ?? "dev"; // commit SHA in CI
var compose = builder.AddDockerComposeEnvironment("compose")
.WithDashboard(dashboard => dashboard.WithHostPort(8080));
var registry = builder.AddContainerRegistry(
"gitlab",
"gitlab..nl:5050",
"namespace/project")
.WithImagePushOptions(options => options.Options.RemoteImageTag = imageTag);
```
My understanding is that `WithImagePushOptions` controls what tag gets pushed, but `prepare-compose` seems to have its own tag generation logic that doesn't respect it. So the compose file and the registry end up out of sync.
Is there a way to make `prepare-compose` use the same tag? Am I missing something in the API, or is this a bug/limitation?
---
As a workaround I'm currently doing a sed replace on the generated file, but that's obviously not ideal:
```bash
IMAGE_TAG=$(git rev-parse --short HEAD)
aspire do prepare-compose
sed -i "s|:20[0-9]\{6\}|:$IMAGE_TAG|g" docker-compose.yaml
aspire do push
```
Contributor guide
Assessment
This issue has not been assessed yet.