# Docker importing a realm to Postgres

**URL:** <https://forum.keycloak.org/t/docker-importing-a-realm-to-postgres/4120>\
**Category:** Getting advice\
**Created:** [August 4, 2020, 8:22pm UTC](https://forum.keycloak.org/t/docker-importing-a-realm-to-postgres/4120 "2020-08-04T20:22:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![christopher-smith](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@christopher-smith](https://forum.keycloak.org/u/christopher-smith)\
**Post date:** [August 4, 2020, 8:22pm UTC](https://forum.keycloak.org/t/docker-importing-a-realm-to-postgres/4120/1 "2020-08-04T20:22:24Z")

</div>

I have a export of all my realms in a single json file  
I want to run Keycloak from a Docker container and use Postgres  
this is my docker run

```
docker run -p 8080:8080 -p 8443:8543 \
--name keycloak --net keycloak-network \
-e KEYCLOAK_USER= ****-e KEYCLOAK_PASSWORD=**** \
-e DB_VENDOR=postgres -e DB_ADDR=postgres -e DB_USER= ****-e DB_PASSWORD=**** \
-e KEYCLOAK_IMPORT=/tmp/example-realm.json \
-v /path/to/all-realm-export.json:/tmp/example-realm.json \
jboss/keycloak

```

This is what I surmise is the relavant port of the log

```
20:11:35,556 INFO [org.hibernate.validator.internal.util.Version] (ServerService Thread Pool -- 60) HV000001: Hibernate Validator 6.0.20.Final
20:11:37,158 INFO [org.hibernate.hql.internal.QueryTranslatorFactoryInitiator] (ServerService Thread Pool -- 60) HHH000397: Using ASTQueryTranslatorFactory
20:11:38,048 FATAL [org.keycloak.services] (ServerService Thread Pool -- 60) Error during startup: java.lang.RuntimeException: java.io.FileNotFoundException: /tmp/example-realm.json (Permission denied)

```

What am I missing?

---

<div class="post-metadata">

**Author:** ![zonaut](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/zonaut/32/666_2.png) [@zonaut](https://forum.keycloak.org/u/zonaut)\
**Post date:** [August 4, 2020, 8:54pm UTC](https://forum.keycloak.org/t/docker-importing-a-realm-to-postgres/4120/2 "2020-08-04T20:54:17Z")

</div>

Take a look at the docker-compose file in [https://github.com/zonaut/keycloak-extensions/](https://github.com/zonaut/keycloak-extensions/)  
I think you might be missing dot before /path/to/all-realm-expor…

---

<div class="post-metadata">

**Author:** ![hmof](https://avatars.discourse-cdn.com/v4/letter/h/2bfe46/32.png) [@hmof](https://forum.keycloak.org/u/hmof)\
**Post date:** [August 6, 2020, 2:31am UTC](https://forum.keycloak.org/t/docker-importing-a-realm-to-postgres/4120/3 "2020-08-06T02:31:02Z")

</div>

`Permission denied` is interesting. Are you sure the user you run Keycloak as can read the file?
