---
title: "Docker images"
description: "Run a public Docker image as a service."
canonical_url: "https://harblet.com/docs/deploy/docker-images"
---
# Docker images

> Run a public Docker image as a service.

An image service runs a Docker image from a registry such as Docker Hub or GitHub Container Registry.

## Create an image service

<steps level="3">

### Open the project

Open a project and click **New service** → **Docker image**.

### Fill in the form

<field-group>
<field name="Name" :required="true">

Up to 64 characters, for example `Web`.

</field>

<field name="Image" :required="true">

The image with its tag, for example `nginx:latest` or `ghcr.io/acme/web:1.4`.

</field>

<field name="Port">

The port your app listens on, from 1 to 65535. Leave it empty if the service doesn't take requests, such as a worker.

</field>
</field-group>

### Create it

Click **Create service**. Harblet deploys the image right away.

</steps>

Follow the deployment on the service's **Deployments** tab. See [Deployments and logs](https://harblet.com/docs/deploy/deployments).

<warning>

Harblet pulls images without credentials, so the image must be public. To deploy private code, use a [Git repository](https://harblet.com/docs/deploy/git-repositories) instead.

</warning>

## Deploy a new version

Every deploy pulls the image's tag again. To ship a new version:

- **Under the same tag,** for example `latest`: push the new image, then click **Deploy**, or call the service's [deploy hook](https://harblet.com/docs/deploy/deploy-hooks) from your pipeline.
- **Under a new tag:** change **Image** under **Settings**, click **Save**, then click **Deploy**.

## The port

The port tells Harblet where your app takes requests. Harblet uses it for:

- the service's [internal address](https://harblet.com/docs/deploy/projects-and-services#connect-services-to-each-other), which other services in the project connect to,
- the [health check](https://harblet.com/docs/deploy/deployments#health-checks) of every new deployment,
- traffic from the service's [domains](https://harblet.com/docs/deploy/domains).

Harblet doesn't pass the port to an image service. Configure the image to listen on it, usually with an [environment variable](https://harblet.com/docs/deploy/environment-variables) the image documents.

## Things to know

- **The container must keep running.** A container that exits, such as a one-off task, counts as crashed and fails the deployment.
- **Files on the container's disk don't last.** They are lost on every deploy and restart. Keep data in a [database](https://harblet.com/docs/deploy/databases) or in external storage.
- **Restarts pull again.** A service that runs a tag asks its registry for the image every time it starts, also after a server reboot. If the registry can't be reached, the service stays down until it can.


## Sitemap

See the full [sitemap](https://harblet.com/sitemap.md) for all pages.
