Skip to main content

Production & Deployment

Laradock's default docker-compose.yml is tuned for local development. Production needs a leaner, locked-down setup, and if you're deploying to Google Cloud, Docker needs to be authenticated against its registry first.

Prepare Laradock for production

For production, create a dedicated Compose file (for example production-docker-compose.yml) that includes only the containers you'll actually run:

docker compose -f production-docker-compose.yml up -d nginx mysql redis ...
Security

do not forward database ports in production. Docker publishes them on the host unless told otherwise, which is insecure. Remove lines like:

ports:
- "3306:3306"

See this post on Docker and iptables for why.

Set up Google Cloud

Configure Docker for the Google Container Registry, then authenticate:

gcloud auth configure-docker
gcloud auth login