Astro inside Container Machine
A Linux workspace for your Astro sites, running right on your Mac.
Released for Mac
Astro inside Container Machine builds a small Linux machine with Apple's container tool and runs Node and Astro inside it. Your project stays in a normal folder on your Mac, and the dev server and builds run in Linux, the same way they do on GitHub Actions.
How it works
The machine starts from the official Node 24 image, with bash and git added. Clearing the image’s entrypoint lets the machine boot init like a full Linux system instead of dropping straight into Node:
FROM node:24-alpine
RUN apk add --no-cache bash git
# Clear the Node image's entrypoint so the machine boots init
ENTRYPOINT []
CMD ["/sbin/init"]
Build the image from the folder that holds the Containerfile, then create the machine from it. A new machine gets half your Mac’s memory by default, so cap it:
cd ~/Developer/Containers/Astro
container build -t local/astro-machine:latest .
container machine create local/astro-machine:latest --name astro
container machine set -n astro cpus=4 memory=4G
container machine stop astro
container machine run -n astro -- node -v # should print v24.x
From then on, do all npm work inside the machine. Change to your project folder on the Mac, and each command runs there:
cd ~/Developer/Astro
container machine run -n astro -- npm install
container machine run -n astro -- npx astro dev --host 0.0.0.0
container machine run -n astro -- npm run build
The dev server is reachable from Safari at the machine’s IP address, and npm run build writes the finished site to dist/ in your Mac folder, ready to deploy. Run container machine set-default astro to drop the -n astro from every command.
What It Does
Node stays off your Mac
Node 24, npm and every package live inside the machine. Nothing is installed on macOS, and removing the machine removes all of it.
Your files stay on your Mac
The machine shares your project folder, so you edit in your usual Mac editor and the built site appears in your Mac's dist folder.
Builds that match deployment
Astro builds in Linux with Linux packages, just like a GitHub Actions runner. If it builds in the machine, it builds when you deploy.
Sized for the job
Give the machine as many CPU cores and as much memory as Astro needs, and stop it when you're done to free them for everything else.