Containers started with windows desktop don't start with terminal

With latest docker desktop, when I start an image, even though the end has CMD ["/init.sh"] the image just exits. I can start it with a command line batch file that includes ‘-it’, but i don’t see any way to specify interactive or tty options when launching from the desktop UI.

It has a port exposed, and I have sshd starting in the container, but the image just exits…

The fact that running a shell and asking for an interactive terminal can keep a container alive is nice, but it is not something you should rely on so it wouldn’t be really useful in Docker Desktop. Specifying the command could be supported but Docker Desktop is not mainly for starting containers. It just has a basic support for starting one if the correct command is running in it. If you want to start a container (not an image), do it from powershell.

Something I wouldn’t run in a container, but I assume you have a vry specific case that requires an SSH daemon, but you need to run it in the foreground. If it runs as a service in the background that will not keep the container alive.

I specified ‘init.sh’ but it’s acutally

/usr/sbin/sshd
/bin/sh

so really I’m running CMD [/bin/sh]

how DO I keep an image running?

I’m using ssh as host waypipe which is a remote connection to wayland gui.

Keep the process running. A simple shell will not run without terminal. sshd could, but if it fails, you need to find out why. The container logs should give you an idea. sshd for example should run this way:

init.sh

#!/usr/bin/env bash
mkdir -p /run/sshd
exec /usr/sbind/sshd -D

Nothing will run that you write after SSHD as it will run in the foreground