Microsoft recently released Edit, a new terminal text editor written in Rust. It's pretty nice - it's reminiscent of nano but with a retro MS DOS feel.
I wanted to run it on my Apple Silicon Mac. Microsoft don't (yet) provide compiled builds for that platform, but they do have a release for aarch64-linux-gnu. I figured I'd run that in o Docker container (I have Docker for Desktop installed) to try it out.
One thing lead to another and I ended up creating and shipping a new Docker image to GitHub's Container Registry. This means anyone with an Apple Silicon Mac and Docker can try out edit against the files in their current directory by running this command:
Hit Ctrl+Q or use your mouse to acces File -> Exit to exit the editor and terminate the container.
I did almost all of my figuring out for this project in this 25 minute Claude Conversation. This post is the edited highlights of what I learned.
Running it first as a one-liner
I started by figuring out a shell one-liner for running the binary. This took a few tries - it turned out Microsoft's compiled binary needed glibc and my first choice of base image, alpine, used musl instead.
I got it working using an Ubuntu base image like this:
Running this command drops you into Bash in the container - running ./edit then opens the editor.
I managed to get Alpine working too by having it install the gcompat package:
Both of these examples take a little while to start as they download a bunch of extra packages every time. I decided to build a reusable image instead.
A multi-stage Docker build
I decided to use Alpine with the gcompat package as it's smaller than using Ubuntu. I told Claude to use a multi-stage build because I didn't want the zstd and curl binaries in the final image, just the edit binary itself.
Here's what we got to:
This has the added bonus that it uses /usr/local/bin/edit as the entrypoint, which means just starting the container will drop you directly into the editor.
I built it like this:
And then tested it with this command:
Publishing to the GitHub Container Registry
GitHub offer a free container registry that can be used to distribute Docker images. I've never tried that before, so this felt like a good opportunity to learn how to use it.
First I needed a GitHub Personal Access Token (PAT) with the right permissions to publish to the registry.
- GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic) - this page here
- Create a new token with these scopes:
- write:packages
- read:packages
I logged into the GitHub Container Registry using this command:
I pasted in the token, then hit enter (and nothing happened), then hit Ctrl+D to finish the login. That seemed to work.
I built the image again with a tag for the GitHub Container Registry:
Then pushed it to the registry with this command:
The published package become available at github.com/users/simonw/packages/container/package/alpine-edit - that page defaulted to private but I clicked on "Package settings" and toggled the visibility to "Public".
Final step: I created an accompanying repository at github.com/simonw/alpine-edit with the Dockerfile and a README.md explaining how to use it, then used the "Connect Repository" button on the package page to link the two together.
Created 2025-06-21T11:16:26-07:00, updated 2025-06-21T13:35:20-07:00 · History · Edit