# Database starting before nakama

**URL:** <https://forum.heroiclabs.com/t/database-starting-before-nakama/1392>\
**Category:** Local Setup\
**Created:** [February 22, 2021, 10:29pm UTC](https://forum.heroiclabs.com/t/database-starting-before-nakama/1392 "2021-02-22T22:29:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LucasGaspar](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/lucasgaspar/32/407_2.png) [@LucasGaspar](https://forum.heroiclabs.com/u/LucasGaspar)\
**Post date:** [February 22, 2021, 10:29pm UTC](https://forum.heroiclabs.com/t/database-starting-before-nakama/1392/1 "2021-02-22T22:29:52Z")

</div>

Hello!  
When running this [docker-compose](https://github.com/heroiclabs/nakama/blob/master/docker-compose.yml) file, most of the time Nakama gets initialized before CockroachDB and Nakama returns an error and it get stuck like this:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/1X/cc28d7e070a1de4787c233cd048451d97e6f6e59.png)  
After stopping the processes and executing again some times CockroachDB gets initialized before Nakama and it runs correctly ![image](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/1X/eb71cf67567ecc940d83daa305e1f254987e17bd.png)  
The problem with this is that the ratio of failure and success is like 20:1, does anyone knows how to solve this?  
I’m running it on Google Compute Engine.

---

<div class="post-metadata">

**Author:** ![LucasGaspar](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/lucasgaspar/32/407_2.png) [@LucasGaspar](https://forum.heroiclabs.com/u/LucasGaspar)\
**Post date:** [February 23, 2021, 4:27pm UTC](https://forum.heroiclabs.com/t/database-starting-before-nakama/1392/2 "2021-02-23T16:27:39Z")

</div>

I was so dumb! Just changed in the docker compose file to `restart: "always"` instead of `restart: "no"` in the Nakama service
