From 707030ad16feee634da01030f667bc02be7655f8 Mon Sep 17 00:00:00 2001 From: lopez Date: Fri, 25 Aug 2023 16:57:25 +0200 Subject: [PATCH] review docker run command --- doc/Grobid-docker.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/doc/Grobid-docker.md b/doc/Grobid-docker.md index 3b9b4567ad..f2f7d69db8 100644 --- a/doc/Grobid-docker.md +++ b/doc/Grobid-docker.md @@ -32,15 +32,17 @@ Current latest version: - Run the container: ```bash -> docker run --rm --gpus --init all -p 8070:8070 grobid/grobid:0.7.3 +> docker run --rm --gpus all --init --ulimit core=0 -p 8070:8070 grobid/grobid:0.7.3 ``` -The image will automatically uses the GPU and CUDA version available on your host machine, but only on Linux. GPU usage via a container on Windows and MacOS machine is currently not supported by Docker. If no GPU are available, CPU will be used. +The image will automatically uses the GPU and CUDA version available on your host machine, but only on Linux. GPU usage via a container on Windows and MacOS machine is currently not supported by Docker. If no GPU are available, CPU will be used. + +Note that starting the container with option `--ulimit core=0` avoids having possible core dumped inside the container, which can happen overwise due to the crash of the PDF parsing C++ component. To specify to use only certain GPUs (see the [nvidia container toolkit user guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/user-guide.html#gpu-enumeration) for more details): ```bash -> docker run --rm --gpus '"device=1,2"' --init -p 8070:8070 -p 8081:8071 grobid/grobid:${latest_grobid_version} +> docker run --rm --gpus '"device=1,2"' --init --ulimit core=0 -p 8070:8070 -p 8081:8071 grobid/grobid:${latest_grobid_version} ``` You can run the image on CPU by omitting the `-gpus` parameters. @@ -48,7 +50,7 @@ You can run the image on CPU by omitting the `-gpus` parameters. Note the default version is running on port `8070`, however it can be mapped on the more traditional port `8080` of your host with the following command: ```bash -> docker run -t --rm --gpus all --init -p 8080:8070 grobid/grobid:${latest_grobid_version} +> docker run --rm --gpus all --init --ulimit core=0 -p 8080:8070 grobid/grobid:${latest_grobid_version} ``` Access the service: @@ -90,19 +92,19 @@ Latest version: - Run the container: ```bash -> docker run -t --rm --init -p 8070:8070 lfoppiano/grobid:${latest_grobid_version} +> docker run --rm --init --ulimit core=0 -p 8070:8070 lfoppiano/grobid:${latest_grobid_version} ``` Latest version: ```bash -> docker run -t --rm --init -p 8070:8070 lfoppiano/grobid:0.7.3 +> docker run --rm --init --ulimit core=0 -p 8070:8070 lfoppiano/grobid:0.7.3 ``` Note the default version is running on port `8070`, however it can be mapped on the more traditional port `8080` of your host with the following command: ```bash -> docker run -t --rm --init -p 8080:8070 -p 8081:8071 lfoppiano/grobid:${latest_grobid_version} +> docker run --rm --init --ulimit core=0 -p 8080:8070 -p 8081:8071 lfoppiano/grobid:${latest_grobid_version} ``` Access the service: @@ -117,7 +119,7 @@ Grobid web services are then available as described in the [service documentatio The simplest way to pass a modified configuration to the docker image is to mount the yaml GROBID config file `grobid.yaml` when running the image. Modify the config file `grobid/grobid-home/config/grobid.yaml` according to your requirements on the host machine and mount it when running the image as follow: ```bash -docker run --rm --gpus all --init -p 8080:8070 -p 8081:8071 -v /home/lopez/grobid/grobid-home/config/grobid.yaml:/opt/grobid/grobid-home/config/grobid.yaml:ro grobid/grobid:0.7.3 +docker run --rm --gpus all --init --ulimit core=0 -p 8080:8070 -p 8081:8071 -v /home/lopez/grobid/grobid-home/config/grobid.yaml:/opt/grobid/grobid-home/config/grobid.yaml:ro grobid/grobid:0.7.3 ``` You need to use an absolute path to specify your modified `grobid.yaml` file. @@ -230,13 +232,13 @@ docker build -t grobid/grobid:0.8.0-SNAPSHOT --build-arg GROBID_VERSION=0.8.0-SN In order to run the container of the newly created image, for example for the development version `0.8.0-SNAPSHOT`, using all GPU available: ```bash -> docker run --rm --gpus all --init -p 8080:8070 -p 8081:8071 grobid/grobid:0.8.0-SNAPSHOT +> docker run --rm --gpus all --init --ulimit core=0 -p 8080:8070 -p 8081:8071 grobid/grobid:0.8.0-SNAPSHOT ``` In practice, you need to indicate which models should use a Deep Learning model implementation and which ones can remain with a faster CRF model implementation, which is done currently in the `grobid.yaml` file. Modify the config file `grobid/grobid-home/config/grobid.yaml` accordingly on the host machine and mount it when running the image as follow: ```bash -docker run --rm --gpus all --init -p 8080:8070 -p 8081:8071 -v /home/lopez/grobid/grobid-home/config/grobid.yaml:/opt/grobid/grobid-home/config/grobid.yaml:ro grobid/grobid:0.8.0-SNAPSHOT +docker run --rm --gpus all --init --ulimit core=0 -p 8080:8070 -p 8081:8071 -v /home/lopez/grobid/grobid-home/config/grobid.yaml:/opt/grobid/grobid-home/config/grobid.yaml:ro grobid/grobid:0.8.0-SNAPSHOT ``` You need to use an absolute path to specify your modified `grobid.yaml` file. @@ -270,7 +272,7 @@ Similarly, if you want to create a docker image from the current master, develop In order to run the container of the newly created image, for example for version `0.7.3`: ```bash -> docker run -t --rm --init -p 8080:8070 -p 8081:8071 grobid/grobid:0.7.3 +> docker run --rm --init --ulimit core=0 -p 8080:8070 -p 8081:8071 grobid/grobid:0.7.3 ``` For testing or debugging purposes, you can connect to the container with a bash shell (logs are under `/opt/grobid/logs/`):