# Correct way with docker run to path to config file and runtime path

**URL:** <https://forum.heroiclabs.com/t/correct-way-with-docker-run-to-path-to-config-file-and-runtime-path/317>\
**Category:** Local Setup\
**Created:** [November 9, 2019, 4:00pm UTC](https://forum.heroiclabs.com/t/correct-way-with-docker-run-to-path-to-config-file-and-runtime-path/317 "2019-11-09T16:00:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![oscargoldman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/oscargoldman/32/28_2.png) [@oscargoldman](https://forum.heroiclabs.com/u/oscargoldman)\
**Post date:** [November 9, 2019, 4:00pm UTC](https://forum.heroiclabs.com/t/correct-way-with-docker-run-to-path-to-config-file-and-runtime-path/317/1 "2019-11-09T16:00:13Z")

</div>

We’re not having any luck comping our go module for the nakama 2.7.0 linux binary, we thought we’d try docker on our production environment. How do we set the --config and --runtime.path properties for docker run heroiclabs/nakama ?  
Trying $HOME/nakama/nakama-config.yml gets us no such file or directory - I guess it’s scoped to the container and not the local file system. Do we have to mount volumes?  
Thanks!

---

<div class="post-metadata">

**Author:** ![mofirouz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mofirouz/32/1523_2.png) [@mofirouz](https://forum.heroiclabs.com/u/mofirouz)\
**Post date:** [November 9, 2019, 7:34pm UTC](https://forum.heroiclabs.com/t/correct-way-with-docker-run-to-path-to-config-file-and-runtime-path/317/2 "2019-11-09T19:34:56Z")

</div>

You’ll definitely need to mount volumes on the docker VM to access files from your local machine. This is pretty standard usage for Docker. Have a look more on this:

> **[Use volumes](https://docs.docker.com/storage/volumes/)**
>
> Volumes are the preferred mechanism for persisting data generated by and used by Docker containers. While bind mounts are dependent on the directory structure of the host machine, volumes are...

---

<div class="post-metadata">

**Author:** ![oscargoldman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/oscargoldman/32/28_2.png) [@oscargoldman](https://forum.heroiclabs.com/u/oscargoldman)\
**Post date:** [November 11, 2019, 1:49pm UTC](https://forum.heroiclabs.com/t/correct-way-with-docker-run-to-path-to-config-file-and-runtime-path/317/3 "2019-11-11T13:49:24Z")

</div>

@mofirouz I have create a volume and it’s working when I run nakama, as the modules folder is automatically created. However I’m having trouble getting the container to find my nakama-config.yml file, as I don’t know what the expected directory is for the container to find the config. I’ve tried putting it in nakama/data next to the modules directory but that doesn’t work. How do I map an external config yml to the container?

---

<div class="post-metadata">

**Author:** ![mofirouz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mofirouz/32/1523_2.png) [@mofirouz](https://forum.heroiclabs.com/u/mofirouz)\
**Post date:** [November 11, 2019, 2:02pm UTC](https://forum.heroiclabs.com/t/correct-way-with-docker-run-to-path-to-config-file-and-runtime-path/317/4 "2019-11-11T14:02:27Z")

</div>

You can try to put your custom config file in the same folder as the modules and referenced it on your `command` or `args` section of your docker.

---

<div class="post-metadata">

**Author:** ![oscargoldman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/oscargoldman/32/28_2.png) [@oscargoldman](https://forum.heroiclabs.com/u/oscargoldman)\
**Post date:** [November 11, 2019, 2:04pm UTC](https://forum.heroiclabs.com/t/correct-way-with-docker-run-to-path-to-config-file-and-runtime-path/317/5 "2019-11-11T14:04:14Z")

</div>

Yeah, I’ve tried that and the response is no such file or directory exists:  
docker run -v docroot:/nakama/data heroiclabs/nakama --config nakama-config.yml  
where nakama-config.yml is in docroot

---

<div class="post-metadata">

**Author:** ![oscargoldman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/oscargoldman/32/28_2.png) [@oscargoldman](https://forum.heroiclabs.com/u/oscargoldman)\
**Post date:** [November 11, 2019, 2:43pm UTC](https://forum.heroiclabs.com/t/correct-way-with-docker-run-to-path-to-config-file-and-runtime-path/317/6 "2019-11-11T14:43:55Z")

</div>

btw this is driven by the documentation, which may need updating:  
docker run --link=db -p 7350:7350 -p 7351:7351 heroiclabs/nakama --database.address root@db:26257 --config /path/to/config.yml --socket.server\_key “mynewkey”  
from the docker quick start page

---

<div class="post-metadata">

**Author:** ![mofirouz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mofirouz/32/1523_2.png) [@mofirouz](https://forum.heroiclabs.com/u/mofirouz)\
**Post date:** [November 11, 2019, 3:21pm UTC](https://forum.heroiclabs.com/t/correct-way-with-docker-run-to-path-to-config-file-and-runtime-path/317/7 "2019-11-11T15:21:10Z")

</div>

According to your example above, `docroot` is mounted to onto the `/nakama/data` directory - You should try and use the full path `/nakama/data/nakama-config.yml` to load the config file.

Failing this, you can use command line flags when starting Nakama to pass custom config.

---

<div class="post-metadata">

**Author:** ![HashtagGo](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@HashtagGo](https://forum.heroiclabs.com/u/HashtagGo)\
**Post date:** [November 15, 2019, 11:01am UTC](https://forum.heroiclabs.com/t/correct-way-with-docker-run-to-path-to-config-file-and-runtime-path/317/8 "2019-11-15T11:01:11Z")

</div>

how to load --config file through docker-compose.yml file

---

<div class="post-metadata">

**Author:** ![oscargoldman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/oscargoldman/32/28_2.png) [@oscargoldman](https://forum.heroiclabs.com/u/oscargoldman)\
**Post date:** [November 15, 2019, 4:52pm UTC](https://forum.heroiclabs.com/t/correct-way-with-docker-run-to-path-to-config-file-and-runtime-path/317/9 "2019-11-15T16:52:04Z")

</div>

You can add the config argument to the entrypoint exec line after exec /nakama/nakama --config /nakama/data/nakama-config.yml
