Running PHP 8.6 Beta CLI in Docker
Scott Keck-Warren • August 31, 2026
I'm working on my yearly "What's new and exciting PHP 8.x" video (if you're interested see my PHP 8.1, PHP 8.2, PHP 8.3, PHP 8.4, PHP 8.5 vidoes) for PHP 8.6. One of the things I've learned the hard way is to always test that my code samples are valid. To do that I need to be running the most current release of PHP 8.6 but I don't want install a beta version of PHP on my laptop that I use all day every day so I like to run it using
cat Makefile IMAGE := php86 TTY := $(shell [ -t 0 ] && echo -t) STAMP := .build
.PHONY: build run shell clean
build: $(STAMP)
$(STAMP): Dockerfile docker build -t $(IMAGE) . @touch $(STAMP)
run: $(STAMP) docker run --rm -i $(TTY) -v $(CURDIR):/app $(IMAGE)
shell: $(STAMP) docker run --rm -i $(TTY) -v $(CURDIR):/app $(IMAGE) bash
clean: rm -f $(STAMP)
cat Dockerfile FROM php:8.6.0beta2-cli
WORKDIR /app
CMD ["php", "-a"]
make run docker run --rm -i -t -v /Users/scottkeck-warren/tmp/php86:/app php86 Interactive shell
php > echo PHP_VERSION; 8.6.0beta2