New

Write a docker-compose.yml for App and Database

A two-service file where the app reaches the database by service name, with the data on a named volume.

Compose puts the services on one network where the service name is the hostname, so the app connects to "db" rather than an IP address. depends_on controls start order only, not readiness, so the app still has to retry its first connection.

When you need this: As soon as one docker run command is not enough, which is the moment a second container appears.

Variables

Command


        
3 views 0 copies
Log in to rate
Log in to save

Free account. Save snippets into your own collections.