Is your rethinkDB container part of your project and managed by Dokku, or did you deploy it manually? If the container is managed by Dokku, it’s possible that Dokku destroys and recreates the container every time you push new commits to Dokku. You’d have to check the logs to make sure if this was the case.
This is actually normal behaviour for Dokku. Containers are supposed to work so that you can despose and recreate them and everything still works. However, making containers behave like this requires some thought, especially in the case of DB containers which need to persist their data. To make sure your database data is preserved even if the DB container is destroyed, you need to use data volumes. Making sure that your node.js project can find your DB container even if the IP address changes requires you to link the containers together and use environmental data rather than hard-coded addresses in your project. You can also go one step further and use some form of service discovery, but that may be overkill for a small-scale project.