# OCI Container Registry Introduction

The OCI Container Registry (Registry) allows you to store private and public container repositories. In this article we cover the basics of connecting to and pushing an image to a private repository to store images.

Before you begin you must have an Oracle Cloud Account as well as [Docker Desktop](https://www.docker.com/products/docker-desktop/) all setup and be able to execute this command in your terminal:

```bash
docker -h
```

We will assume you already have a docker image locally and you want to push it to OCI Container Registry.

List your local docker images with the `docker images` command:

```bash
> docker images

myapp-server    latest        9fcb20691b9b   39 hours ago    137MB
```

Before you can push that image to OCI you need to do two things

1. Sign into OCI.
    
2. Tag the local image with a specifically formatted name.
    

## Sign into OCI

Here's an example of signing into OCI:

```bash
> docker login ord.ocir.io

User: yourtenancy/oracleidentitycloudservice/jstortz
Password: <your oci auth token here>
```

As you can see, you'll need to get an OCI Auth token before you can complete the sign-in step. To do this:

1. In the top-right corner of the Console, open the **Profile** menu and then click **User settings** to view the details.
    
2. On the **Auth Tokens** page, click **Generate Token**.
    
3. Enter a friendly description for the auth token. Avoid entering confidential information.
    
4. Click **Generate Token**. The new auth token is displayed.
    
5. Copy the auth token immediately to a secure location from where you can retrieve it later, because you won't see the auth token again in the Console.
    
6. Close the Generate Token dialog.
    

Now you can attempt to sign-in with OCI.

## Tag and Push

First, tag the image. You can see what "ID" you need to use by running `docker images`.

The basic syntax to tag your image looks like this:

docker tag &lt;image-id&gt; &lt;region-domain&gt;/&lt;tenancy&gt;/&lt;container-name&gt;:&lt;version&gt;

Example:

```markdown
docker tag d2973444a992 ord.ocir.io/redstone/myapp:v1
```

The "ord.ocir.io" part depends on what [OCI Region](https://docs.oracle.com/en-us/iaas/Content/Registry/Concepts/registryprerequisites.htm#regional-availability) you want to use.

Use `docker images` to list your local images and confirm you now see this new tag

Then push with:

docker push &lt;region-domain&gt;/&lt;tenancy&gt;/&lt;container-name&gt;:version

Like this:

```markdown
docker push ord.ocir.io/redstone/myapp:v1
```

Voila! Your image is in OCI Registry and ready for you to deploy with various technologies like [OCI Container Instances](https://www.oracle.com/cloud/cloud-native/container-instances/).

### References

[Pushing Images Using the Docker CLI (oracle.com)](https://docs.oracle.com/en-us/iaas/Content/Registry/Tasks/registrypushingimagesusingthedockercli.htm)

[Container Instances Documentation (oracle.com)](https://docs.oracle.com/en-us/iaas/Content/container-instances/home.htm)
