containerd / containerd/nerdctl

Make the error message clearer when args `-d` is mixed with `-tty` in `nerdctl compose`

Open
#1,960 3 comments 2 reactions 0 assignees View on GitHub
kind/feature
Dominant language
Go
Stars
10.4k
Forks
826
Avg merge
1d 23h
Merged PRs (30d)
44

Description

### What is the problem you're trying to solve

The following `compose.yaml` file:
```yaml
version: '3'
services:
test-cache:
image: "redis:3.2.10"
ports:
- "6379:6379"
test-fakesmtp:
image: munkyboy/fakesmtp
ports:
- "1025:25"
tty: true
test-node:
image: node:slim
depends_on:
- test-cache
- test-fakesmtp
```
works with `docker-compose` (version 1.25.0) but fails on `nerdctl` with the following error:
```
INFO[0000] Creating network tmp_default
INFO[0000] Ensuring image munkyboy/fakesmtp
INFO[0000] Ensuring image redis:3.2.10
INFO[0000] Ensuring image node:slim
INFO[0000] Creating container tmp_test-cache_1
INFO[0000] Creating container tmp_test-fakesmtp_1
INFO[0000] Creating container tmp_test-node_1
FATA[0001] currently StdinOpen(-i) and Tty(-t) should be same
```

### Describe the solution you'd like

The fatal error message can be traced to [lines 161-164](https://github.com/containerd/nerdctl/blob/f772408de01aaecb34d4636a37cdbbc66f98c436/pkg/composer/up_service.go#L161-L164) in `composer/up_service.go`:

```golang
// FIXME
if service.Unparsed.StdinOpen != service.Unparsed.Tty {
return "", fmt.Errorf("currently StdinOpen(-i) and Tty(-t) should be same")
}
```

Wondering if there is a way to make the error message more explicit.
Something like:
> "Mixing (-d) and (-tty) is not yet supported.

Since the [docs](https://github.com/containerd/nerdctl/blob/f772408de01aaecb34d4636a37cdbbc66f98c436/docs/command-reference.md#whale-blue_square-nerdctl-run) already says: *WIP: currently -t conflicts with -d*

### Additional context

Thank you for your work on this project 🙏.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.