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: https://roots.io/bedrock/

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.

https://hub.docker.com/r/bitpoke/wordpress-runtime/tags?page=1&name=bedrock

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:

@strarsis pull access denied for strarsis/php-bedrock, repository does not exist or may require ‘docker login’: denied: requested access to the resource is denied

docker pull strarsis/docker-php-bedrock:8.0.1-fpm
(https://hub.docker.com/layers/strarsis/docker-php-bedrock/8.0.1-fpm/images/sha256-b910666b2f556733098210b0fbd91b6af8072b1cdc0790ce39f5e1d456c278ae?context=repo)

DockerHub currently does not automatically build from (GitHub) source?
PHP 8.1; 8.2 and 8.3 branches were added to GitHub repository: