JSON Server provides REST API mocking based on plain JSON. This is a docker image that eases setup.
1.1K
JSON Server provides REST API mocking based on plain JSON. This is a docker image that eases setup.
This docker image is available as a trusted build on the docker index, so there's no setup required. Using this image for the first time will start a download automatically. Further runs will be immediate, as the image will be cached locally.
The recommended way to run this container looks like this:
$ docker run -d -p {OutsidePort}:80 -v {AbsolutePathToJsonFile}:/data/db.json jcmds/jsonserver
The above example exposes the JSON Server REST API on port 80, so that you can now browse to http://localhost/
You can supply any number of JSON Server arguments that will be passed through unmodified.
$ docker run -it --rm jcmds/jsonserver --help
If you mount a file to /data/db.json (as in the above example),
it will automatically be used as the plain JSON data source file.
A sample file could look like this:
{
"posts": [
{ "id": 1, "body": "foo" },
{ "id": 2, "body": "bar" }
],
"comments": [
{ "id": 1, "body": "baz", "postId": 1 },
{ "id": 2, "body": "qux", "postId": 2 }
]
}
Content type
Image
Digest
Size
380.1 MB
Last updated
over 5 years ago
docker pull jcmds/jsonserver