Docker image + bedrock & sage

My trip into trying to get bedrock + sage to work on a WSL2 + Ubuntu + Docker setup has been quite the nightmare.

Roots offers an official docker image: GitHub - roots/bedrock-docker:

This is php8.0 image and I have got it working up untill the prompt to install Acorn. However, installing Acorn upgrades the composer dependency of php to 8.1. This breaks everything in the docker image.

I have tried to manually upgrade the image to php8.1 but this creates a lot of problems with extensions and dependencies for laravel etc.

I have tried a lot of different setups via Google, even create an official php image, and I’m now counting 4 full days of troubleshooting.

Does anyone have any pointers to a dockerfile & docker-compose.yml that actually works with bedrock+sage, I’d be very grateful.

Hi @hum,

We’ve had success with the runtime images taken from the Bitpoke stack. They provide Bedrock-specific containers with PHP-FPM and Nginx. These images are intended as a production runtime on K8s, but will work for Docker.

Creating a docker-compose.yml with a MySQL service should be fairly trivial after that.

I’m not advocating this approach for production, but if you want to bundle Node and some other dev tooling into the image, you might be able to cannibalise this. This can be useful if you want a fully isolated dev container. This dockerfile uses multi-stage builds: runtime without dev tooling, and dev with node / mysql-client.

Thank you!

I’ll look into the Bitpoke stack. And indeed, I’m intending to use this only for local development.

You may find this also interesting:

This looks really nice! Sadly I need a php8.1+ image.

How would you recommend upgrading your image to 8.1?

Yes, I had not looked into this for a few months now. As I now also migrated everything to PHP 8.1, it is time to update those images. :smile_cat: