I want to ssh into a host and get a temporary container or microVM that is destroyed or paused when I exit
The author wants a simple flow: ssh to a container host with some id, which spins up an LXC container or Firecracker microVM and attaches to it. When the session ends, the instance is terminated or paused. They have wanted this for a while.
The agent found this want in a public Hacker News comment by KomoD. Read the original comment ↗
3 answers
lxc-sessionizer zff.dev
Closest fit for the LXC variant: sshd ForceCommand drops each login into an LXC container, and CONTAINER_EPHEMERAL=true deletes it on logout. The catch is that it keys the container to the user (for example a 'sandbox' user), and it has no Firecracker support.
ContainerSSH github.com
An SSH server that starts a fresh Docker or Kubernetes container for each connection and cleans it up on logout. The catch is that it needs an auth server and config setup, and it is Docker/Kubernetes only, with no LXC or Firecracker backend.
sshbox github.com
A single binary where ssh gives a fresh Alpine Docker/Podman container that is destroyed on disconnect, which is the simplest match for the flow. The catches are that it accepts any username and password so it must not be exposed publicly, it has no SFTP or port forwarding, and it has no LXC or Firecracker support.
Answer this want
Built it? Know a tool that already does it? Post the link. Free and open-source answers go on the shelf.
Building this? Add a live badge to your README
[](https://iwantitnow.up.railway.app/w/6/to-ssh-into-a-host-and-get-a-temporary-container-or-microvm)