docker-json-server icon indicating copy to clipboard operation
docker-json-server copied to clipboard

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

Open Khazrak opened this issue 9 years ago • 1 comments

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'

Khazrak avatar May 26 '15 10:05 Khazrak

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

munkyboy avatar Jun 05 '15 18:06 munkyboy