containerd / containerd/nerdctl
Unable to Use Compose with Windows Containers
- Dominant language
- Go
- Stars
- 10.4k
- Forks
- 826
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 44
Description
### Description
When running nerdctl compose up, by default a `--hostname` parameter is passed to `nerdctl run` which is invalid on Windows OS.
https://github.com/containerd/nerdctl/blob/v2.0.2/pkg/containerutil/container_network_manager_windows.go#L50-L64
https://github.com/containerd/nerdctl/blob/v2.0.2/pkg/composer/serviceparser/serviceparser.go#L608-L614
### Steps to reproduce the issue
1. Use a similar docker-compose.yaml file:
```yaml
services:
github:
image: mcr.microsoft.com/dotnet/runtime:8.0-windowsservercore-ltsc2019
isolation: hyperv
platform: windows/amd64
restart: unless-stopped
scale: 1
# Hostname gets set and causes problem
```
2. `nerdctl compose up`
### Describe the results you received and expected
We would expect the container to be started successfully.
```plain
> nerdctl compose up
time="2025-01-10T18:35:02Z" level=warning msg="Ignoring: service github: [Isolation]"
time="2025-01-10T18:35:02Z" level=info msg="Ensuring image mcr.microsoft.com/dotnet/runtime:8.0-windowsservercore-ltsc2019"
time="2025-01-10T18:35:02Z" level=info msg="Creating container runners-github-1"
time="2025-01-10T18:35:02Z" level=info msg="Running [C:\\Program Files\\nerdctl\\nerdctl.exe run --cidfile=C:\\Users\\user\\AppData\\Local\\Temp\\2\\compose-2714756652\\cid -l=com.docker.compose.project=runners -l=com.docker.compose.service=github -d --name=runners-github-1 --pull=never --net=runners_default --hostname=github --platform=windows/amd64 --restart=unless-stopped mcr.microsoft.com/dotnet/runtime:8.0-windowsservercore-ltsc2019]"
time="2025-01-10T18:35:03Z" level=fatal msg="failed to verify networking settings: the following networking arguments are not supported on Windows: [--hostname]"
time="2025-01-10T18:35:03Z" level=fatal msg="error while creating container runners-github-1: error while creating container runners-github-1: exit status 1"
```
### What version of nerdctl are you using?
```plain
nerdctl version
time="2025-01-10T18:36:06Z" level=warning msg="unable to determine runc version: exec: \"runc\": executable file not found in %PATH%"
Client:
Version: v2.0.2
OS/Arch: windows/amd64
Git commit: 1220ce7ec2701d485a9b1beeea63dae3da134fb5
buildctl:
Version: v0.18.2
GitCommit: e4da654b1251f91e914fab18eba33743aefd7080
Server:
containerd:
Version: v2.0.1
GitCommit: 88aa2f531d6c2922003cc7929e51daf1c14caa0a
runc:
Version:
```
### Are you using a variant of nerdctl? (e.g., Rancher Desktop)
None
### Host information
```plain
Windows Server 2019
Microsoft Windows [Version 10.0.17763.6659]
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.