> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vast.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating Templates for GROBID

## Introduction

This guide demonstrates creating a template using an existing Docker image. See our [Creating Templates](/guides/templates/creating-templates) guide for more details on template configuration. We will be using the image from [GROBID on dockerhub](https://hub.docker.com/r/grobid/grobid).

## Find The Image and Tag You Want to Use

### Step 1 - Find a Suitable Image

There are multiple GROBID images in dockerhub, but for this guide we will be using the official GROBID image.

<Frame caption="Grobid Overview">
  ![Grobid Overview](https://vast.ai/uploads/grobid_overview.png)
</Frame>

### Step 2 - Selecting the Version Tag

If you don't already have a version you intend to use, we recommend selecting the latest stable version.&#x20;

<Frame caption="Stable Tag">
  ![Stable Tag](https://vast.ai/uploads/stable_tag.png)
</Frame>

At the time of writing, the current stable version is 0.8.0, so that is the version we'll be using here.

## Configuring The Template

### Step 1 - Setting Your Chosen Image and Tag in Your Vast.ai Template

In the Docker Repository And Environment section, you will enter your image path and tag.

<Frame caption="Imageandtag">
  ![Imageandtag](https://vast.ai/uploads/templates/ImageAndTag.png)
</Frame>

### Step 2 - Map Ports and Specify Your Image and Tag Combination

The overview page for this image at dockerhub has a link to their guide to [using GROBID with containers](https://grobid.readthedocs.io/en/latest/Grobid-docker/#crf-and-deep-learning-image), which you can read to get their recommendations for containerizing GROBID.&#x20;

As we follow their guide to containerizing GROBID, we'll need to make sure the container's port 8070 is set to the host machine's port 8070. We will do that in the Vast.ai template. We use -p 8070:8070 as one of the docker run options.

<Frame caption="Run Cmd">
  ![Run Cmd](https://vast.ai/uploads/run_cmd.png)
</Frame>

**Note:** Vast only allows -e and -p docker run options to set environment variables and expose ports.

<Frame caption="Grobidport">
  ![Grobidport](https://vast.ai/uploads/templates/GrobidPort.png)
</Frame>

### Step 3 - Select the Launch Mode

Here we will select the SSH launch mode.

<Frame caption="Sshdirect">
  ![Sshdirect](https://vast.ai/uploads/templates/SSHDirect.png)
</Frame>

### Step 4 - Look for CMD or ENTRYPOINT command

<Frame caption="Found Tag">
  ![Found Tag](https://vast.ai/uploads/found_tag.png)
</Frame>

To find this for the template we are creating, we searched the [image's page in Dockerhub](https://hub.docker.com/r/grobid/grobid) and found the **CMD **command in the **Tags** tab under the link "0.8.0" highlighted in blue.

<Frame caption="Found Cmd">
  ![Found Cmd](https://vast.ai/uploads/found_cmd.png)
</Frame>

### Step 5 - Fill Out On-start Script section using the CMD command we just found

Next, we add the contents of the **CMD **command to the end of the bash commands section of the **On-start Script** fields.

Also, appended environment variables to /etc/environment file in our on-start section.

<img src="https://mintcdn.com/vastai-80aa3a82/xCLov_y0JNSp_qUD/images/console-creating-templates-for-grobid.webp?fit=max&auto=format&n=xCLov_y0JNSp_qUD&q=85&s=8c2a472c7f7376a29c6d74c4de94b596" alt="" width="930" height="159" data-path="images/console-creating-templates-for-grobid.webp" />

This makes environment variables available to all users and processes and ensures they are persistent even if our instance/docker container is rebooted. We suggest doing the same for your templates.

### Step 6 - Name and Save The Template

<Frame caption="Grobidexample">
  ![Grobidexample](https://vast.ai/uploads/templates/GrobidExample.png)
</Frame>

When you are finished setting up your template, If you haven't already done so, specify the template name and description.

Finally, click **Create & Use** to save the template and navigate to the GPU offers search page. You'll notice that your template is selected and ready to be used.

## Rent an Instance Using Your Template and Open GROBID Web App

Once you have selected an instance offer, You'll click on the **INSTANCES **link in the left menu and see your rented GPU instance that has your template applied.&#x20;

<img src="https://mintcdn.com/vastai-80aa3a82/xCLov_y0JNSp_qUD/images/console-creating-templates-for-grobid-2.webp?fit=max&auto=format&n=xCLov_y0JNSp_qUD&q=85&s=4feb5053b253885ec8fe5dd7d54fb45e" alt="" width="910" height="151" data-path="images/console-creating-templates-for-grobid-2.webp" />

When the instance is done loading and the **>\_CONNECT** state on the blue button appears, you should be able to see the ip range button at the top of the instance card.

<img src="https://mintcdn.com/vastai-80aa3a82/xCLov_y0JNSp_qUD/images/console-creating-templates-for-grobid-3.webp?fit=max&auto=format&n=xCLov_y0JNSp_qUD&q=85&s=a359678ad0010345f644c553508d3f4f" alt="" width="800" height="120" data-path="images/console-creating-templates-for-grobid-3.webp" />

If you click the IP range button you will see a new modal has the IP and port information for your instance. You'll see the port 8070 that we set listed in Open Ports.

<img src="https://mintcdn.com/vastai-80aa3a82/xCLov_y0JNSp_qUD/images/console-creating-templates-for-grobi-4.webp?fit=max&auto=format&n=xCLov_y0JNSp_qUD&q=85&s=645a9347c850c1862a99840c968d568a" alt="" width="800" height="1077" data-path="images/console-creating-templates-for-grobi-4.webp" />

You can copy the machine IP and port and load the address (in this example: 195.0.159.206:55734) in a new browser tab or window. This address will load the GROBID web app.

<img src="https://mintcdn.com/vastai-80aa3a82/xCLov_y0JNSp_qUD/images/console-creating-templates-for-grobid-5.webp?fit=max&auto=format&n=xCLov_y0JNSp_qUD&q=85&s=39196202780eece3d7c8f0d05bac6021" alt="" width="1114" height="369" data-path="images/console-creating-templates-for-grobid-5.webp" />

## Additional Resources

[GROBID Documentation](https://grobid.readthedocs.io/en/latest/)
