This repository provides a flexible Docker environment for developing Shopify apps, themes, and using the Shopify CLI. It is suitable for any developer and any Shopify project.
- Node.js (LTS) for app development
- Ruby (latest stable) for theme development and Shopify CLI
- Shopify CLI (latest)
- Yarn, npm, pnpm
- Git, zsh, build tools
- Locale: en_US.UTF-8
docker-compose builddocker-compose up -ddocker exec -it shopify-dev zshYour project files are mounted at /workspace inside the container.
- Run your app as usual (e.g.,
npm run devorshopify app dev). - Port 3000 is exposed for local development.
- Use Shopify CLI commands, e.g.:
shopify theme serve
- Port 9292 is exposed for theme preview.
- All CLI commands are available:
shopify version shopify login shopify app create node shopify theme pull
- You can add more dependencies by editing the
Dockerfile. - Mount other directories as needed by editing
docker-compose.yml.
- Make sure you have Docker and Docker Compose installed.
- For Shopify login, use device authentication in the CLI (browser-based login works from inside the container).
When you run shopify login or any command that requires authentication, the CLI will print a device code and a login link. Simply copy the link and open it in your host machine's browser. After you complete authentication, the CLI in the container will detect the login automatically.
Note:
- If you see an error like
Error: spawn xdg-open ENOENT, it just means the CLI couldn't open a browser inside the container. This is harmless—just copy the link and open it manually. - You do NOT need XQuartz, X11, or a browser inside the container for Shopify CLI login.
This project includes a helper script (shopify-dev) that makes working with the Docker environment easy and fast.
chmod +x shopify-devRun the script with one of the following commands:
./shopify-dev up # Start the Docker container
./shopify-dev down # Stop the Docker container
./shopify-dev shell # Enter a shell (zsh) inside the container
./shopify-dev app # Run Shopify app (pnpm dev) in the container
./shopify-dev theme # Run Shopify theme serve in the container
./shopify-dev logs # Show container logs- Start the container:
./shopify-dev up
- Enter the container shell:
./shopify-dev shell
- Run your Shopify app or theme commands as needed.
- When finished, stop the container:
./shopify-dev down
- All your project files are available at
/workspaceinside the container. - You can use
pnpm,npm,yarn,shopify, and all other tools inside the shell. - The script makes it easy for any developer to get started without memorizing Docker commands.
Happy Shopify hacking!