---
title: "Creating and Using a Docker Image Stored in an OVHcloud Managed Private Registry (Harbor)"
description: "Learn how to create a Docker image, store it in the OVHcloud Managed Private Registry service, and use it from a Docker client."
url: https://docs.us.ovhcloud.com/en/public-cloud/managed-private-registry/create-private-image
lang: en
---
> For AI agents: the complete documentation index is available at https://docs.us.ovhcloud.com/en/llms.txt, the full documentation bundle is available at https://docs.us.ovhcloud.com/en/llms-full.txt.

# Creating and Using a Docker Image Stored in an OVHcloud Managed Private Registry (Harbor)

**Learn how to create a Docker image, store it in the OVHcloud Managed Private Registry service, and use it from a Docker client.**

OVHcloud Managed Private Registry service provides a managed, authenticated Docker registry where you can privately store your Docker images.

 

## Requirements

- an OVHcloud Managed Private Registry (see the [creating a private registry](https://docs.us.ovhcloud.com/en/public-cloud/managed-private-registry/create-private-registry.md) guide for more information)
- access to the Harbor UI to operate the private registry (see the [connecting to the UI](https://docs.us.ovhcloud.com/en/public-cloud/managed-private-registry/connecting-harbor-user-interface.md) guide for more information)
- a private project and a user with the right to read and write on the project (see the [managing users and projects](https://docs.us.ovhcloud.com/en/public-cloud/managed-private-registry/managing-users-projects-harbor.md) guide for more information)
- a functioning Docker desktop deployment [installed on the client](https://docs.docker.com/engine/install/)

 

## Instructions

### Get your OVHcloud Managed Private Registry API URL

From the [OVHcloud Control Panel](https://manager.us.ovhcloud.com/):

1. Select `Public Cloud` in the top navigation bar.
2. Select your project.
3. In the left-hand navigation menu, under **Containers & Orchestration**, click `Managed Private Registry`.
4. Select the _more options_ `...` button at the right of your registry and click `Harbor API`.

Copy the URL of the API Harbor, it's the URL of your private registry and we are going to use it several times in this guide.

> In fact, when you click the copy button as indicated by a hand icon in the image, the copied string starts with `https://`. Please remove the `https://` part.

 

### Creating a Docker image

You're going to create a Docker image using a very simple Dockerfile and some resource files.

Create a `hello-ovh/` folder in a known location and inside create:

- A `Dockerfile` file:

```
FROM nginx:1.15-alpine

COPY index.html /usr/share/nginx/html/index.html
COPY ovh.svg /usr/share/nginx/html/ovh.svg
```

- A `index.html` file:

```
<!doctype html>
<html>
  <head>
    <title>OVHcloud K8S</title>
    <style>
      .title {
      font-size: 3em;
      padding: 2em;
      text-align: center;
      }
    </style>
  </head>
  <body>
    <div class="title">
      <p>Hello from Private Registry!</p>
      <img src="./ovh.svg">
    </div>
  </body>
</html>
```

- A `ovh.svg` file (right click and save it):

You should have these files in your `hello-ovh` directory:

```
├── Dockerfile
├── index.html
└── ovh.svg
```

- Go into the `hello-ovh` folder, containing the three files, and do a `docker build`. You will need to tag your build using your private registry URL, the project within the registry (_private_ if you followed the [managing users and projects](https://docs.us.ovhcloud.com/en/public-cloud/managed-private-registry/managing-users-projects-harbor.md) guide), and the image name (_hello-ovh_):

```
docker build --tag [YOUR_PRIVATE_REGISTRY_URL]/[YOUR_PROJECT]/hello-ovh:1.0.0 .
```

Here is the result of running the command for my private registry in the `private` project:

```
$ docker build --tag 8093ff7x.c1.va1.container-registry.ovh.us/private/hello-ovh:1.0.0 .
Sending build context to Docker daemon  14.34kB
Step 1/3 : FROM nginx:1.15-alpine
1.15-alpine: Pulling from library/nginx
e7c96db7181b: Pull complete 
264026bbe255: Pull complete 
a71634c55d29: Pull complete 
5595887beb81: Pull complete 
Digest: sha256:57a226fb6ab6823027c0704a9346a890ffb0cacde06bc19bbc234c8720673555
Status: Downloaded newer image for nginx:1.15-alpine
---> dd025cdfe837
Step 2/3 : COPY index.html /usr/share/nginx/html/index.html
---> f1f2487532bc
Step 3/3 : COPY ovh.svg /usr/share/nginx/html/ovh.svg
---> 3f803b45da18
Successfully built 3f803b45da18
Successfully tagged 8093ff7x.c1.va1.container-registry.ovh.us/private/hello-ovh:1.0.0
```

- Login to your private registry, using a user with write rights to the project (_private-user_ if you followed the [managing users and projects](https://docs.us.ovhcloud.com/en/public-cloud/managed-private-registry/managing-users-projects-harbor.md)**&#xA0;**&#x67;uide)

```
docker login [YOUR_PRIVATE_REGISTRY_URL]
```

In my private registry:

```
$ docker login 8093ff7x.c1.va1.container-registry.ovh.us
Username: private-user
Password: 
Login Succeeded
```

- Upload the image to the private registry

```
docker push [YOUR_PRIVATE_REGISTRY_URL]/[YOUR_PROJECT]/hello-ovh:1.0.0
```

In my private registry example:

```
$ docker push 8093ff7x.c1.va1.container-registry.ovh.us/private/hello-ovh:1.0.0
The push refers to repository [8093ff7x.c1.va1.container-registry.ovh.us/private/hello-ovh]
369ed87ef8b1: Pushed 
d2220a0eb85b: Pushed 
a521e1bbddf5: Pushed 
bf381a670956: Pushed 
a61993362baf: Pushed 
f1b5933fe4b5: Pushed 
1.0.0: digest: sha256:f5a6a8f0d7c95cf3926b504a7949c8575e478106b59d8913ab947729aa5bd075 size: 1568
```

 

If you go to your Harbor UI, you will see a `hello-ovh` repository in the _private_ project:

 

This repository will store all the versions of the `hello-ovh` image (right now only the _1.0.0_):

 

### Deploy the private image

Now you can use `docker pull` (preceded by a `docker login` on your private registry if you're doing it from a different computer) to deploy the image from the OVHcloud Managed Private Registry.

```
docker pull [YOUR_PRIVATE_REGISTRY_URL]/[YOUR_PROJECT]/hello-ovh:1.0.0 
```

In my private registry example:

```
$ docker pull 8093ff7x.c1.va1.container-registry.ovh.us/private/hello-ovh:1.0.0
1.0.0: Pulling from private/hello-ovh
e7c96db7181b: Already exists 
264026bbe255: Already exists 
a71634c55d29: Already exists 
5595887beb81: Already exists 
4c1b9819c67d: Pull complete 
5df2876c6416: Pull complete 
Digest: sha256:f5a6a8f0d7c95cf3926b504a7949c8575e478106b59d8913ab947729aa5bd075
Status: Downloaded newer image for 8093ff7x.c1.va1.container-registry.ovh.us/private/hello-ovh:1.0.0
```

And then you can run it:

```
docker run -d -p 80:80 [YOUR_PRIVATE_REGISTRY_URL]/[YOUR_PROJECT]/hello-ovh:1.0.0 
```

In my private registry example:

```
$ docker run -d -p 8080:80 8093ff7x.c1.va1.container-registry.ovh.us/private/hello-ovh:1.0.0
c18f071c3c8c10ca636ed9be84878c12f3a270b6def131eb756f69435b978da1
```

And now you can test it with the `curl` command:

```
$ curl localhost:8080
<!doctype html>

<html>
<head>
<title>OVH K8S</title>
</head>
<style>
.title {
font-size: 3em;
padding: 2em;
text-align: center;
}
</style>
<body>
<div class="title">
<pHello from Private Registry!</p>
<img src="./ovh.svg">
</div>
</body>
</html>
```

Or in your browser:

**Warning:**

**NOTE:** You need to enter `localhost:8080` in your browser's address bar.

 

## Go further

Browse all the [Managed Private Registry (MPR) guides](https://docs.us.ovhcloud.com/en/public-cloud/managed-private-registry/landing-page-managed-private-registry.md).

Browse the rest of the [OVHcloud US documentation](https://docs.us.ovhcloud.com/en/index.md) for guides on our other products and services.

Learn more about [Managed Private Registry](https://us.ovhcloud.com/public-cloud/managed-private-registry/) on the OVHcloud US website.
