nerdctl
nerdctl copied to clipboard
`nerdctl start` cannot start containers in `Created` or `Exited` status (`OCI runtime create failed: cannot allocate tty if runc will detach without setting console socket`)
Required behavior: Allow start Created or Exited containers, either with nerdctl start
or nerdctl exec -it
.
Actual behavior:
you can run a container, for example: nerdctl run -it nginx:latest --name nginx-container
.
You can stop it: nerdctl stop nginx-container
.
Issue:
You cannot start again the container neither nerdctl start nginx-container
nor nerdctl exec -it nginx-container /bin/sh
.
Error messages:
nerdctl start nginx-container
:
FATA[0000] OCI runtime create failed: cannot allocate tty if runc will detach without setting console socket: unknown
nerdctl exec -it nginx-container /bin/sh
:
FATA[0000] no running task found: task 0a88555b90488894c72918665b9b14bd6ae96e89676d65ca772b9abf34727884 not found: not found
Environment:
- OS: MacOs Big Sur 11.0.1.
- Backend: Rancher Desktop 0.6.0 (nerdctl 0.12.1).
-it is currently incomparable with stop/start, please use -d
-it is currently incomparable with stop/start, please use -d
It didn't work, I created and ran the container with nerdctl run --name my-container -d nginx
, even modified the image to set the ENTRYPOINT to /bin/bash
; the container exited immediately because there's no interactive nor tty attached, so there's no process to maintain running in background.
Then, I tried to start or exec the exited container but got the following output:
nerdctl start my-container
: started the container but exited immediately due to the mentioned above.
nerdctl exec -it my-container /bin/sh
: FATA[0000] cannot exec in a stopped state: unknown
, which is logical because we cannot execute commands on stopped containers.
I think in the meantime it cannot be achieve until the implementation of the create
action from docker, because it allows us to define the -it
parameters at creation time, then we can start the container in background allowing the interactive/tty connection for later.
+1 migrating from docker, very annoying nerdctl start -i <container>
doesn't work after nerctl run -ti <image> /bin/bash
.
Yes, cannot start stopped containers.
yes, same here...cannot start the container which is in the CREATED
state
failed to create shim task: OCI runtime create failed: runc create failed: cannot allocate tty if runc will detach without setting console socket: unknown
has anyone found any workaround/solution to this?
is anyone know how to run image properly ? i run image with :
nerdctl run -it overlayfs@sha256:564f654982832faaeb09ab49b4b543b83a79f478b5d73bc2785fe0aa07648597
after i stop container and i want to run it again with :
nerdctl container start overlayfs@sha256:564f654982832faaeb09ab49b4b543b83a79f478b5d73bc2785fe0aa07648597
it say
FATA[0000] failed to create shim task: OCI runtime create failed: runc create failed: cannot allocate tty if runc will detach without setting console socket: unknown
i have version
nerdctl version
Client:
Version: v1.0.0
OS/Arch: linux/amd64
Git commit: <unknown>
buildctl:
Version: 0.10.5
GitCommit: v0.10.5
Server:
containerd:
Version: v1.6.9
GitCommit: v1.6.9
runc:
Version: 1.1.4
current solution : run container with -d flag
nerdctl run -d overlayfs@sha256:564f654982832faaeb09ab49b4b543b83a79f478b5d73bc2785fe0aa07648597
i don't know why it immediately stop the container if you run nerdctl ps -a
it will have status Exited (0) even after add --restart flag it will restarting in loop, btw you can start container with command :
nerdctl start -a overlayfs@sha256:564f654982832faaeb09ab49b4b543b83a79f478b5d73bc2785fe0aa07648597
but it will give you blank shell, if you type ls it will response :
ls
bin
boot
dev
etc
home
lib
lib64
media
mnt
opt
proc
root
run
sbin
srv
sys
tmp
usr
var