make build image=php8.0
Put your PHP application into src/
and public files (e.g. index.php
) into src/public/
Makefile provides shortcuts. Argument php
is optional
make start php=8.0
For xdebug images
make debug php=8.0
To stop containers
make stop
Nginx listening for files in src/public/
on port 8080
.
To run composer inside container exec
docker exec -it project_dir_php_1 composer install
or use official composer image https://store.docker.com/images/composer
Note: Official composer image is used unside
php
container.
For fresh docker installation read Post-installation steps for Linux
To avoid permissions issues follow instructions from article "Use Linux user namespaces to fix permissions in docker volumes"
Word USER
in listings should be replaced by your system user name: id -u -n
- Create or add to existing file
/etc/docker/daemon.json
{
"userns-remap": "USER"
}
- Edit file
/etc/subuid
USER:1000:1
USER:100000:65536
- Edit file
/etc/subgid
USER:996:1
USER:100000:65536
Replace 996
with value returned by command getent group docker
Instead of above you can also often run
chown $(id -un) -R .