This image base on node:13.10.1-alpine3.11
To build the Docker image, run the following command:
docker build -t gitbook .
To initialize a new GitBook project, navigate to the directory where you want to create your GitBook project and run:
docker run --rm -v "$PWD/hello-gitbook:/gitbook" -p 4000:4000 gitbook gitbook init
To serve your GitBook project, navigate to the directory containing your GitBook project and run:
docker run --rm -v "$PWD/hello-gitbook:/gitbook" -p 4000:4000 gitbook gitbook serve
If you encounter the following error:
Error: Couldn't locate plugins ".....". Run 'gitbook install' to install plugins from registry.
You can install the necessary plugins by running:
docker run --rm -v "$PWD/{path-to-your-project}:/gitbook" -p 4000:4000 gitbook gitbook install
After installing the plugins, you can serve your GitBook again:
docker run --rm -v "$PWD/{path-to-your-project}:/gitbook" -p 4000:4000 gitbook gitbook serve