Kasm Workspaces on fly.io - Having Trouble

See a workaround to run init with PID 1. In your case, you’ll need to create a file init-wrapper with the script from that comment, mark it executable (chmod +x), and add a Dockerfile that looks like this:

FROM linuxserver/kasm

# emulate PID 1
COPY init-wrapper /
ENTRYPOINT ["/init-wrapper"]

# switch from nftables to legacy iptables, otherwise /usr/local/bin/dockerd-entrypoint.sh fails
RUN \
    update-alternatives --set iptables /usr/sbin/iptables-legacy && \
    update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

The last part (update-alternatives, source) is to fix the following error:

failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: iptables v1.8.7 (nf_tables): Could not fetch rule set generation id: Invalid argument

Then use fly launch (without an image argument), and it will use the Dockerfile to build a custom image based on linuxserver/kasm but with init-wrapper to emulate PID 1.

Check fly logs to make sure there are no errors, then run fly proxy 3000 and open https://127.0.0.1:3000 (you’ll get a security warning due to Kasm’s self-signed certificate, that’s fine).