# Tried to build package registry image but no content

**URL:** <https://discuss.elastic.co/t/tried-to-build-package-registry-image-but-no-content/329039>\
**Category:** Elastic Agent\
**Created:** [March 31, 2023, 10:24am UTC](https://discuss.elastic.co/t/tried-to-build-package-registry-image-but-no-content/329039 "2023-03-31T10:24:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mudboyzh](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Mudboyzh](https://discuss.elastic.co/u/Mudboyzh)\
**Post date:** [March 31, 2023, 10:24am UTC](https://discuss.elastic.co/t/tried-to-build-package-registry-image-but-no-content/329039/1 "2023-03-31T10:24:55Z")

</div>

Hi  
I have already deployed ELK / Elastic Agent / Package registry with official images. They work well.  
Because of our company's standard, images have to fix vulnerability before deploy on k8s(air-gapped),  
I have to fix image's os level vulnerability which scanned by Trivy or Grype.

Most of official Elastic Stack images use ubuntu as base image I guess.  
Some of os package vulnerabilities on ubuntu base image seem that can not be fixed for now.  
So I tried to change base image and update the vulnerable packages.

It works for me to fix Elasticsearch / Kibana / Logstash images.  
When I tried to fix package registry image, It seems not easy like ELK image.  
Before I change base image of package registry, I want to build image just like official image.  
Make sure it just work fine. My steps:

1. Clone the [source code](https://github.com/elastic/package-registry/tree/main).
2. Run `mage build`
3. Run `docker build`

After I built image, I found the image size is much smaller than official image.  
I found there is not content inside. It will be closed immediately after deploy.  
I didn't see any build step about how to download content from official site before build image.  
Do I missing something ?

The official image has lots of content in `/packages/package-storage`.  
I copy those content to volume and mount to the container with image I built from source code.  
It will stuck at searching packages until crashing.  
Here is the log.

```auto
{"log.level":"info","@timestamp":"2023-03-31T10:15:08.900Z","log.origin":{"file.name":"package-registry/main.go","file.line":304},"message":"Packages paths: /packages/package-registry","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-03-31T10:15:08.901Z","log.origin":{"file.name":"package-registry/main.go","file.line":305},"message":"Cache time for /: 10s","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-03-31T10:15:08.901Z","log.origin":{"file.name":"package-registry/main.go","file.line":306},"message":"Cache time for /index.json: 10s","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-03-31T10:15:08.901Z","log.origin":{"file.name":"package-registry/main.go","file.line":307},"message":"Cache time for /search: 10m0s","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-03-31T10:15:08.901Z","log.origin":{"file.name":"package-registry/main.go","file.line":308},"message":"Cache time for /categories: 10m0s","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-03-31T10:15:08.901Z","log.origin":{"file.name":"package-registry/main.go","file.line":309},"message":"Cache time for all others: 10m0s","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-03-31T10:15:08.901Z","log.origin":{"file.name":"package-registry/main.go","file.line":140},"message":"Package registry started","ecs.version":"1.6.0"}
{"log.level":"info","@timestamp":"2023-03-31T10:15:09.579Z","log.origin":{"file.name":"packages/packages.go","file.line":227},"message":"Searching packages in /packages/package-registry","ecs.version":"1.6.0"}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 28, 2023, 10:25am UTC](https://discuss.elastic.co/t/tried-to-build-package-registry-image-but-no-content/329039/2 "2023-04-28T10:25:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
