> ## Documentation Index
> Fetch the complete documentation index at: https://vastai-80aa3a82-ltxv2-serverless.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Creating Templates for GROBID

<script
  type="application/ld+json"
  dangerouslySetInnerHTML={{
__html: JSON.stringify({
"@context": "https://schema.org",
"@type": "HowTo",
"name": "How to Create a Vast.ai Template for GROBID",
"description": "A complete walkthrough of creating a Vast.ai template using an existing Docker image, demonstrated with GROBID as an example application.",
"step": [
  {
    "@type": "HowToStep",
    "name": "Find a Suitable Docker Image",
    "text": "Search for the official GROBID image on DockerHub. There are multiple GROBID images available, but use the official one from grobid/grobid for this guide."
  },
  {
    "@type": "HowToStep",
    "name": "Select the Version Tag",
    "text": "Choose a version tag from the Tags tab. We recommend selecting the latest stable version. At the time of writing, the current stable version is 0.8.0."
  },
  {
    "@type": "HowToStep",
    "name": "Set Image and Tag in Template",
    "text": "In the Docker Repository And Environment section of the Vast.ai template editor, enter your image path and tag (e.g., grobid/grobid:0.8.0)."
  },
  {
    "@type": "HowToStep",
    "name": "Map Ports",
    "text": "According to the GROBID containerization guide, port 8070 needs to be exposed. Add -p 8070:8070 in the Ports section to map the container's port 8070 to the host machine's port 8070."
  },
  {
    "@type": "HowToStep",
    "name": "Select Launch Mode",
    "text": "Select the SSH launch mode for this template to enable command-line access to the instance."
  },
  {
    "@type": "HowToStep",
    "name": "Configure On-start Script",
    "text": "Find the CMD or ENTRYPOINT command in the image's DockerHub page under the Tags tab. Add this command to the On-start Script section. Also append environment variables to /etc/environment file to make them available to all users and processes."
  },
  {
    "@type": "HowToStep",
    "name": "Name and Save Template",
    "text": "Specify the template name and description, then click 'Create & Use' to save the template and navigate to the GPU offers search page."
  },
  {
    "@type": "HowToStep",
    "name": "Rent Instance and Access GROBID",
    "text": "Select an instance offer and rent it. Once the instance is ready (blue 'CONNECT' button appears), click the IP range button to see the IP and port information. Copy the machine IP and port to load the GROBID web app in your browser."
  }
]
})
}}
/>

## Introduction

This guide demonstrates creating a template using an existing Docker image. See our [Creating Templates](/documentation/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-ltxv2-serverless/raWWQ-_K1M8Puobr/images/console-creating-templates-for-grobid.webp?fit=max&auto=format&n=raWWQ-_K1M8Puobr&q=85&s=d5253968162964859d16faa37ef4a083" 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-ltxv2-serverless/raWWQ-_K1M8Puobr/images/console-creating-templates-for-grobid-2.webp?fit=max&auto=format&n=raWWQ-_K1M8Puobr&q=85&s=05445cfb24942d34e4943ede3ec5fde9" 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-ltxv2-serverless/raWWQ-_K1M8Puobr/images/console-creating-templates-for-grobid-3.webp?fit=max&auto=format&n=raWWQ-_K1M8Puobr&q=85&s=e4131c49eb2e8e7d2216f9e84c8f4f4c" 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-ltxv2-serverless/raWWQ-_K1M8Puobr/images/console-creating-templates-for-grobi-4.webp?fit=max&auto=format&n=raWWQ-_K1M8Puobr&q=85&s=8743fc4be27d00a55ed684f59fbfde3b" 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-ltxv2-serverless/raWWQ-_K1M8Puobr/images/console-creating-templates-for-grobid-5.webp?fit=max&auto=format&n=raWWQ-_K1M8Puobr&q=85&s=04bdeb1dedb0de2adf1cf9d27edcb6b5" 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/)
