# Create multiple containers with a shared database

**URL:** <https://forums.docker.com/t/create-multiple-containers-with-a-shared-database/127893>\
**Category:** General\
**Tags:** docker, docker-compose\
**Created:** [August 17, 2022, 1:42pm UTC](https://forums.docker.com/t/create-multiple-containers-with-a-shared-database/127893 "2022-08-17T13:42:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![psmjonas](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/psmjonas/32/34617_2.png) [@psmjonas](https://forums.docker.com/u/psmjonas)\
**Post date:** [August 17, 2022, 1:42pm UTC](https://forums.docker.com/t/create-multiple-containers-with-a-shared-database/127893/1 "2022-08-17T13:42:39Z")

</div>

I would like to create multiple Docker containers, but they use the same database. In the best case this should happen in one step e.g. via docker-compose. Is this possible? The file system of the containers should of course be separate.

 ![docker](https://global.discourse-cdn.com/docker/original/3X/2/3/23c4e30307e014545c00a4642388da9f790d361c.png)

---

<div class="post-metadata">

**Author:** ![avbentem](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@avbentem](https://forums.docker.com/u/avbentem)\
**Post date:** [August 17, 2022, 2:10pm UTC](https://forums.docker.com/t/create-multiple-containers-with-a-shared-database/127893/2 "2022-08-17T14:10:02Z")

</div>

Of course this is possible. It seems [Orientation and setup | Docker Documentation](https://docs.docker.com/get-started/) may be a good start, especially Part 7, Multi-container apps and Part 8, Use Docker Compose. (But: I’d start from the beginning.)

Using the example in that documentation, both WordPress containers could refer to `mysql` as the database’s host name.
