Easily deploy Laravel to Docker with Spin
Deploying Laravel to production if you don’t have much experience doing it previously can be tough, but it’s even harder deploying it to Docker. That’s exactly where Spin comes in. Spin helps you in development, CI/CD, staging, production, and more.
- Replicate in any environment: Ship with confidence and never worry about environment differences again.
- Runs on Mac, Windows, Linux: Work with any developer, regardless of operating system.
- Choose any host: Break free from vendor lock-in and host wherever you’re comfortable.
- Zero-downtime deployments: Ship updates without your customers experiencing downtime.
- Docker syntax, simplified: Spin follows Docker standards but simplifies the development experience.
- Simple server management: Reduce server complexity to a single command.
- GitHub Action support: Deploy automatically and easily with GitHub Actions.
- Automated SSL: Manage SSL certificates automatically with Let’s Encrypt via configuration templates.
I started using Spin a year ago and since then I’ve moved every single one of my Laravel projects over to it—it has been a dream. When I first learned Docker, getting Laravel running was a real challenge. Spin has completely changed that and makes it easy to host Laravel apps across development, staging, and production, while ensuring environments remain identical so you avoid unexpected issues in production.
Previously I used Laravel Sail but had to write all of my own Dockerfiles to be able to run Laravel in production and staging. This is exactly why Spin is great!
Spin was created by a two-man team of wizards at ServerSideUp, who also build and manage a variety of other popular open-source projects. It offers both a free and a Pro version. The free version has limitations—especially if you lack a solid Docker background to build templates yourself. Personally, I’ve only used Spin Pro since it has everything I need out of the box, so I won’t cover the free version here.
Spin Pro gives you everything needed to get a Laravel app running in development and production within minutes. Simply
run spin new to create a new project, or spin init to initialise Spin in an existing app. That handles everything for you
so your Laravel codebase is deployment-ready.
Getting your servers ready for deployment
Spin uses Ansible in the background to provision and maintain servers. At the time of writing, you can use Digital Ocean, Hetzner, or Vultr to automatically deploy/order servers via their API — just add the API keys to your .spin.yml file.
Don’t want to use those providers? No problem. Spin works with almost any host—from major cloud platforms to an old dusty computer in your home office. The requirements for your own server are minimal:
- CPU: 1 core
- RAM: 1GB
- Storage: >25GB SSD
- Architecture: x86_64 (64-bit)
- Operating System: Ubuntu 22.04 LTS or newer
- Firewall: Allow SSH and HTTPS traffic (22/tcp, 80/tcp, 443/tcp, 2222/tcp)
- Access: Root SSH access
- A fresh OS installed
Once your server is ready, just run spin provision and Spin will handle the rest. This will get the server ready to go
for deployment.
Deploying your Laravel application
With your server(s) ready, simply run spin deploy production. Your Laravel app will be deployed via Docker Swarm, which
also supports multi-node clusters. Docker doesn’t yet support this natively, but I’ve outlined how to achieve it in the
Spin Pro repository discussions if you want to explore it further after purchasing.
This is by far the easiest and quickest way to deploy a Laravel application.
You can also deploy with GitHub Actions, which is what I personally use. This isn’t available in the free version, so you’d need to write your own workflows. Spin Pro, however, provides everything for you and even offers the choice of whether to add workflows to your codebase during the project initialisation wizard.
Wrapping Up
Some steps and details are missing here to keep things brief, but I strongly recommend checking out the documentation and joining the Discord. The Discord server is fantastic for troubleshooting and getting answers quickly.
I highly recommend at least trying the free version, and seriously considering Spin Pro — it has everything you need already built in. It’s become my go-to tool for developing and deploying Laravel apps, and I expect it will remain so for a long time.
Please also check out the video below by Jay who does a full walkthrough and explanation of Spin and how it works.
This post contains affiliate links, but this does not affect my opinions in any way.



