Previously, you had a single container running all services, so they could communicate inside that container via localhost
or 127.0.0.1
.
In the current setup, each service runs in its own container, and they communicate using their container names. For example, PHP connects to Redis using the redis
hostname. If it tries to connect via 127.0.0.1
, it would be referring to itself, where Redis isnβt running. The same applies to MySQL, PostgreSQL, Memcached, or any other service.
This approach has more benefits:
- you or the end-user can set service version per user
- limit CPU/RAM for each service
- upgrade/downgrade versions easily
- add custom services - any docker image