clue / docker-json-server

JSON Server docker image, REST API mocking based on plain JSON
310 stars 134 forks source link

http://localhost:80/posts with example json crashes container #1

Open Khazrak opened 9 years ago

Khazrak commented 9 years ago

Hi. I run the container with the example json (posts and comments). When I go to the adress: http://localhost:80/posts I get the data but the container crashes. The same if I use curl.

I get the response:

GET /posts 304 16.824 ms - -

/usr/local/lib/node_modules/json-server/node_modules/lowdb/src/disk.js:23 if (err) throw err ^ Error: EBUSY, rename '/data/.~db.json'

munkyboy commented 9 years ago

I ran into the same problem. I worked around it by mounting a directory to the container's /data directory instead of directly mounting a file.

broken:

docker run -v responses/products.json:/data/db.json json-server

working:

docker run -v responses:/data json-server products.json