containerd / containerd/nerdctl

`failed to attach to the container: failed to open stdout fifo: error creating fifo binary:///usr/local/bin/nerdctl?_NERDCTL_INTERNAL_LOGGING=%2Fvar%2Flib%2Fnerdctl%2F1935db59: no such file or directory`

Open
#2,877 10 comments 2 reactions 1 assignee Claimed by @fahedouch View on GitHub
bug
Dominant language
Go
Stars
10.4k
Forks
826
Avg merge
1d 23h
Merged PRs (30d)
44

Description

### Discussed in https://github.com/containerd/nerdctl/discussions/2876

Originally posted by **haytok** March 13, 2024
## Question

If we try to attach to a container that has been started as shown below, the following error will occur.

```bash
[haytok@lima-finch workspace]$ sudo nerdctl run --name test -d alpine sh -c "while true; do echo /'Hello, world/'; sleep 1; done"
54f605cda9b8184a5d16a543ba482dfaa1a90d3e71d9903c19b667bd202f5b18
[haytok@lima-finch workspace]$ sudo nerdctl ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
54f605cda9b8 docker.io/library/alpine:latest "sh -c while true; d…" 3 seconds ago Up test
[haytok@lima-finch workspace]$ sudo nerdctl attach test
FATA[0000] failed to attach to the container: failed to open stdout fifo: error creating fifo binary:///usr/local/bin/nerdctl?_NERDCTL_INTERNAL_LOGGING=%2Fvar%2Flib%2Fnerdctl%2F1935db59: no such file or directory
```

Is this the expected behavior?

There seems to be an error in the following part of nerdctl, but I'm in trouble because I don't know how to fix it.

- https://github.com/containerd/nerdctl/blob/main/pkg/cmd/container/attach.go#L96C1-L99C3
- https://github.com/containerd/nerdctl/blob/9ce158bb9a259a999a33db54b43119ee36e50569/pkg/cioutil/container_io_unix.go#L122

Note that Docker doesn't cause such an error, and we can attach it to a container.

## Environments

I'm using the following versions of containerd and nerdctl.

```bash
[haytok@lima-finch workspace]$ containerd --version
containerd github.com/containerd/containerd v1.7.13 7c3aca7a610df76212171d200ca3811ff6096eb8
[haytok@lima-finch workspace]$ nerdctl version
WARN[0000] failed to inspect the rootless containerd socket address error="stat /run/user/504/containerd-rootless: no such file or directory"
Client:
Version: v1.7.3
OS/Arch: linux/amd64
Git commit: 0a464409d0178e16d3d2bed36222937ec3fc9c77
buildctl:
Version: v0.12.5
GitCommit: bac3f2b673f3f9d33e79046008e7a38e856b3dc6
```

Note that containerd and nerdctl are running in Lima launched from Finch.

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.