Local development vs deployment

I have a couple of questions with regards to docker in a local development environment vs deployment.

Say I had 3 or 4 apps in separate codebases, each with their own docker compose file.
Now lets say I also had a shared database for all the apps.

So the database would like like:

Servername

  • app1 database
  • app2 database
  • app3 database.

If I wanted to replicate this setup locally on my laptop, I could run the database in a docker container with a volume (?) to allow persistence when its not running (I think).

I could then spin up any of my apps and they could connect to the database - using a network in the docker compose file (I think).

So all is good for local development.

Now lets say we want to deploy our apps.

We will have a dedicated sql server database on an EC2 instance, so the database is separate. What about the ‘network’ in the docker compose files for the apps? Does this need to be removed? If we deploy each app container separately, can they communicate with each other through api calls etc?

Any best practices here or could you point me in the right direction - is this a common scenario for local development vs deployment?