Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Use Compose with Windows Containers #3963

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TinaMor
Copy link
Contributor

@TinaMor TinaMor commented Mar 3, 2025

PR Description

For Docker compatibility, we allow the value that is set for Host

Background

Linked Issue: containerd/nerdctl#3808

How to test this change?

  1. Sample docker-compose.yaml
services:
  github:
    image: mcr.microsoft.com/dotnet/runtime:8.0-windowsservercore-ltsc2022
    isolation: hyperv
    platform: windows/amd64
    restart: unless-stopped
    scale: 1
    hostname: github-container  # Set a valid hostname
    command: ["ping", "-t", "localhost"]  # Keep the container alive
  1. CNI: microsoft/windows-container-networking
  2. Command:
>  _output/nerdctl compose up

  time="2025-03-03T20:06:37+03:00" level=warning msg="Ignoring: service github: [Isolation]"
  time="2025-03-03T20:06:37+03:00" level=info msg="Ensuring image mcr.microsoft.com/dotnet/runtime:8.0-windowsservercore-ltsc2022"
  time="2025-03-03T20:06:37+03:00" level=info msg="Re-creating container tina-github-1"
  time="2025-03-03T20:06:37+03:00" level=info msg="Running [C:\\Work\\nerdctl\\_output\\nerdctl.exe run --cidfile=C:\\Users\\tina\\AppData\\Local\\Temp\\compose-3927316773\\cid -l=com.docker.compose.project=tina -l=com.docker.compose.service=github -d --name=tina-github-1 --pull=never --net=tina_default --hostname=github-container --platform=windows/amd64 --restart=unless-stopped mcr.microsoft.com/dotnet/runtime:8.0-windowsservercore-ltsc2022 hostname]"
  time="2025-03-03T20:06:38+03:00" level=info msg="Attaching to logs"
  github-1 |3f372f051f8a
  time="2025-03-03T20:06:38+03:00" level=info msg="Container \"tina-github-1\" exited"
  time="2025-03-03T20:06:38+03:00" level=info msg="All the containers have exited"
  time="2025-03-03T20:06:38+03:00" level=info msg="Stopping containers (forcibly)"
  time="2025-03-03T20:06:38+03:00" level=info msg="Stopping container tina-github-1"

@TinaMor TinaMor changed the title Docker compatibility: Windows HostName should be allowed [Fix] Use Compose with Windows Containers Mar 3, 2025
@apostasie
Copy link
Contributor

@AkihiroSuda this is draft but this one would be nice to have in v2.0.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants