2025-06-21 19:20:00
til.simonwillison.net
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:
docker run --platform linux/arm64 -it --rm -v $(pwd):/workspace ghcr.io/simonw/alpine-edit
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.
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:
docker run --platform linux/arm64 -it --rm \
-v $(pwd):/workspace \
-w /workspace ubuntu:latest sh -c "
apt update && \
apt install -y zstd curl && \
curl -L https://github.com/microsoft/edit/releases/download/v1.2.0/edit-1.2.0-aarch64-linux-gnu.tar.zst -o edit.tar.zst && \
zstd -d edit.tar.zst && \
tar -xf edit.tar && \
chmod +x edit && \
exec bash"
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:
docker run --platform linux/arm64 -it --rm \
-v $(pwd):/workspace \
-w /workspace alpine:latest sh -c "
apk add --no-cache zstd curl gcompat && \
curl -L https://github.com/microsoft/edit/releases/download/v1.2.0/edit-1.2.0-aarch64-linux-gnu.tar.zst -o edit.tar.zst && \
zstd -d edit.tar.zst && \
tar -xf edit.tar && \
chmod +x edit && \
exec sh"
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.
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:
# Build stage - download and extract the binary
FROM alpine:latest AS builder
# Install tools needed for download/extraction
RUN apk add --no-cache zstd curl
# Download and extract the edit binary
RUN curl -L https://github.com/microsoft/edit/releases/download/v1.2.0/edit-1.2.0-aarch64-linux-gnu.tar.zst -o /tmp/edit.tar.zst \
&& zstd -d /tmp/edit.tar.zst \
&& tar -xf /tmp/edit.tar -C /tmp/ \
&& chmod +x /tmp/edit
# Final runtime stage - minimal image
FROM alpine:latest
# Install only runtime dependencies
RUN apk add --no-cache \
gcompat \
libgcc \
&& rm -rf /var/cache/apk/*
# Copy the binary from build stage
COPY --from=builder /tmp/edit /usr/local/bin/edit
# Set working directory
WORKDIR /workspace
# Set the edit binary as the entrypoint
ENTRYPOINT ["/usr/local/bin/edit"]
# Default to current directory if no args provided
CMD ["."]
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:
docker build --platform linux/arm64 -t alpine-edit .
And then tested it with this command:
docker run --platform linux/arm64 -it --rm -v $(pwd):/workspace alpine-edit
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:
docker login ghcr.io -u simonw --password-stdin
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:
docker build --platform linux/arm64 -t ghcr.io/simonw/alpine-edit:latest .
Then pushed it to the registry with this command:
docker push ghcr.io/simonw/alpine-edit:latest
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
Keep your files stored safely and securely with the SanDisk 2TB Extreme Portable SSD. With over 69,505 ratings and an impressive 4.6 out of 5 stars, this product has been purchased over 8K+ times in the past month. At only $129.99, this Amazon’s Choice product is a must-have for secure file storage.
Help keep private content private with the included password protection featuring 256-bit AES hardware encryption. Order now for just $129.99 on Amazon!
Help Power Techcratic’s Future – Scan To Support
If Techcratic’s content and insights have helped you, consider giving back by supporting the platform with crypto. Every contribution makes a difference, whether it’s for high-quality content, server maintenance, or future updates. Techcratic is constantly evolving, and your support helps drive that progress.
As a solo operator who wears all the hats, creating content, managing the tech, and running the site, your support allows me to stay focused on delivering valuable resources. Your support keeps everything running smoothly and enables me to continue creating the content you love. I’m deeply grateful for your support, it truly means the world to me! Thank you!
BITCOIN bc1qlszw7elx2qahjwvaryh0tkgg8y68enw30gpvge Scan the QR code with your crypto wallet app |
DOGECOIN D64GwvvYQxFXYyan3oQCrmWfidf6T3JpBA Scan the QR code with your crypto wallet app |
ETHEREUM 0xe9BC980DF3d985730dA827996B43E4A62CCBAA7a Scan the QR code with your crypto wallet app |
Please read the Privacy and Security Disclaimer on how Techcratic handles your support.
Disclaimer: As an Amazon Associate, Techcratic may earn from qualifying purchases.