# What happens if my built image needs artifactory permissions to download mvn packages

**URL:** https://community.okteto.com/t/what-happens-if-my-built-image-needs-artifactory-permissions-to-download-mvn-packages/1330
**Category:** How Do I?
**Created:** [September 23, 2024, 9:24am UTC](https://community.okteto.com/t/what-happens-if-my-built-image-needs-artifactory-permissions-to-download-mvn-packages/1330 "2024-09-23T09:24:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mario](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/mario/32/292_2.png) [@mario](https://community.okteto.com/u/mario)
#### Post date: [September 23, 2024, 9:24am UTC](https://community.okteto.com/t/what-happens-if-my-built-image-needs-artifactory-permissions-to-download-mvn-packages/1330/1 "2024-09-23T09:24:03Z")

</div>

Im using a private artifactory with all my blobs and when my Dockerimage builds, it fails because it has no permissions to download them with maven.

---

<div class="post-metadata">

### Author: ![mario](https://sea1.discourse-cdn.com/flex019/user_avatar/community.okteto.com/mario/32/292_2.png) [@mario](https://community.okteto.com/u/mario)
#### Post date: [September 23, 2024, 9:35am UTC](https://community.okteto.com/t/what-happens-if-my-built-image-needs-artifactory-permissions-to-download-mvn-packages/1330/2 "2024-09-23T09:35:58Z")

</div>

In the `build` section of the **Okteto Manifest** there is an option to add `secrets` to your built image.

> **[Okteto Manifest Reference | Okteto Documentation](https://www.okteto.com/docs/reference/okteto-manifest/#build-object-optional)**
>
> Okteto's Manifest for describing development environments

It is called `secrets `, and you can set there the ENVs that will be used inside the image:

```auto
build:
  frontend:
    context: frontend
    dockerfile: Dockerfile
    secrets:
      mysecret: mysecret

```

This secret will be mount into the image (see Dockerfile [sample](https://www.okteto.com/docs/admin/dashboard/#admin-variables))

Define the ENVs you are using in the Okteto `Admin Panel` as Admin vars.

```auto
USER
PASSWORD

```

There are two ways to use them after this:

1. Mount as secret the full settings.xml file using the ENVs added in the Admin Panel

**settings.xml:**

```auto
<servers>
 <server>
   <username>${USER}</username>
   <password>${PASSWORD}</password>
 </server>
</servers>

```

**Okteto Manifest:**

```auto
build:
  frontend:
    context: frontend
    dockerfile: Dockerfile
    secrets:
      settings: settings.xml

```

**Dockerfile:**

```auto
RUN --mount=type=secret,id=settings,target=/etc/secrets/settings.xml (mvn command using this settings)

```

And then just run your `maven` command using the file mounted, and it should connect to your server.

1. Add the instruction itself to the secret file and RUN it in the Dockerfile
2. 

**secret\_file** :

```auto
mvn deploy -DaltReleaseDeploymentRepository=myrepo::https://$USER:$PASSWORD@server/repo 

```

**Okteto Manifest:**

```auto
build:
  frontend:
    context: frontend
    dockerfile: Dockerfile
    secrets:
      secret_file: secret_file

```

**Dockerfile** :

```auto
RUN --mount=type=secret,id=secret_file,target=/etc/secrets/secret_filecat $(cat /etc/secrets/secret_file)

```

If you need more help with maven configuration: [How to pass Maven settings via environment vars - Stack Overflow](https://stackoverflow.com/questions/31251259/how-to-pass-maven-settings-via-environment-vars)
