Yes, this is do-able with Docker. You can create a shared Docker network for the shared containers, and then create separate networks for each of the project setups. You can then use Docker Compose to define the services for each project, and link them to the shared network.
For example, you could create a docker-compose.yml file for each project, which would define the services for that project. You could then link the services to the shared network, so that they can communicate with each other.
For example, the docker-compose.yml file for a project could look something like this:
version: '3'
services:
php:
image: php:8.2
networks:
- shared-network
nginx:
image: nginx
networks:
- shared-network
depends_on:
- php
networks:
shared-network:
external:
name: shared-network
This would create two services (php and nginx) and link them to the shared network. The nginx service would also depend on the php service, so that it can detect when the php service is running and redirect requests to it.
You can then use Docker Compose to start the services for each project, and they will be able to communicate with each other via the shared network.
Hope this helps!