Closed apostasie closed 3 months ago
Here is a simple repro:
nerdctl --debug-full=true run -ti debian echo lo </dev/null |& cat
Here is a repro for the compose one as seen on usernetes:
compose.yaml
services:
web:
image: node
command: ["sleep", "Inf"]
nerdctl compose up -d
nerdctl compose exec web echo lol </dev/null |& cat
FWIW, docker exec gives:
docker exec -ti 7e36c314c3bd59ba590035fc6c1c4d96a0e1a4981ae0e02f7e6bdaddfc0d8b92 echo lol </dev/null |& cat
the input device is not a TTY
While docker compose exec will just run with it:
docker compose exec web echo lol </dev/null |& cat
lol
@AkihiroSuda @fahedouch do you have an idea on how we should handle this?
My naive reading is that this is two fold:
and mmm...
docker compose exec -ti web echo lol </dev/null |& cat
lol
Closing this. Although there are clearly other conditions that may trigger this error, the scope would be much broader and this specific issue here is fixed by the patch.
It also happens when run -t in systemd unit.
Here is my systemd service unit /usr/local/bin/docker is a symbolic link to /usr/local/bin/nerdctl
[Unit] Description=DNS Master Internal After=containerd.service Requires=containerd.service
[Service] ExecStartPre=-/usr/local/bin/docker exec dns-master-internal stop ExecStartPre=-/usr/local/bin/docker rm dns-master-internal ExecStartPre=-/usr/local/bin/docker pull docker.xcastlabs.net/services/dns-host:latest ExecStart=/usr/local/bin/docker run -t --name=dns-master-internal \ --init \ --log-driver=journald \ --log-opt=tag={{.Name}} \ --env=DC=mke \ --env=DNSZONE_TYPE=master \ --env=DNSZONE_VIEW=internal \ --env=SERVICE_NAME=dns-master-internal \ --env=SERVICE_PORT=53 \ --env=BIND_DATA_DIR=/dns \ --cap-add=CAP_SYS_PTRACE \ --cap-add=CAP_NET_ADMIN \ --cap-add=CAP_NET_RAW \ --cap-add=CAP_NET_BIND_SERVICE \ --cap-add=CAP_SETUID \ --cap-add=CAP_SETGID \ --volume=/dns/master-internal:/dns:rw \ --net=vlan1225-dns-internal-masters \ \ docker.xcastlabs.net/services/dns-host:latest ExecStop=-/usr/local/bin/docker stop dns-master-internal SyslogIdentifier=dns-master-internal Restart=on-failure KillMode=mixed RestartSec=10s TimeoutStartSec=120 TimeoutStopSec=15
[Install] WantedBy=default.target
I tried privileged mode it is all the same. BTW, podman works just fine in the same setup
Here is the result in journalctl
The unit tmp-containerd\x2dmount3662397617.mount has successfully entered the 'dead' state. Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: panic: provided file is not a console Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: goroutine 1 [running]: Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: github.com/containerd/console.Current() Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: /home/runner/go/pkg/mod/github.com/containerd/console@v1.0.4/console.go:80 +0x94 Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: github.com/containerd/nerdctl/v2/cmd/nerdctl/container.runAction(0xc00049e608, {0xc000434dc0, 0x1, 0x14}) Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: /home/runner/work/nerdctl/nerdctl/cmd/nerdctl/container/container_run.go:392 +0x70a Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: github.com/spf13/cobra.(Command).execute(0xc00049e608, {0xc000144020, 0x14, 0x14}) Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:985 +0xaaa Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: github.com/spf13/cobra.(Command).ExecuteC(0xc00049e008) Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: github.com/spf13/cobra.(*Command).Execute(...) Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041 Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: main.xmain() Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: /home/runner/work/nerdctl/nerdctl/cmd/nerdctl/main.go:144 +0x8f Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: main.main() Sep 17 20:37:11 sbc21n1-mke dns-master-internal[147972]: /home/runner/work/nerdctl/nerdctl/cmd/nerdctl/main.go:127 +0x13 Sep 17 20:37:11 sbc21n1-mke systemd[1]: dns-master-internal.service: Main process exited, code=exited, status=2/INVALIDARGUMENT ░░ Subject: Unit process exited
Description
Likely while mistakenly starting a container with
-ti
on the CI.We probably want to do better than a panic.
Steps to reproduce the issue
na
Describe the results you received and expected
na
What version of nerdctl are you using?
main
Are you using a variant of nerdctl? (e.g., Rancher Desktop)
None
Host information
No response