# Nexus Docker container eating up all of my hosts's memory?

**URL:** <https://community.sonatype.com/t/nexus-docker-container-eating-up-all-of-my-hostss-memory/8452>\
**Category:** Sonatype Nexus Repository\
**Created:** [March 31, 2022, 3:37pm UTC](https://community.sonatype.com/t/nexus-docker-container-eating-up-all-of-my-hostss-memory/8452 "2022-03-31T15:37:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zillag](https://avatars.discourse-cdn.com/v4/letter/z/ed655f/32.png) [@zillag](https://community.sonatype.com/u/zillag)\
**Post date:** [March 31, 2022, 3:37pm UTC](https://community.sonatype.com/t/nexus-docker-container-eating-up-all-of-my-hostss-memory/8452/1 "2022-03-31T15:37:45Z")

</div>

Nexus v 3.32.0-03

I have a dedicated Linux Ubuntu host with 32G memory running my Nexus server, which I configured to run as a Docker container, which I start this way.

```auto
docker run --rm -d -p 8081:8081 --memory 16g --name nexus -v nexus-data:/nexus-data sonatype/nexus3

```

For some reason, it just eats up all my systems’s memory despite of the `--memory 16g` flag. I restarted my host last night, and today I see this. `htop` shows a bunch of PIDs from user `200` that use `5G` memory.

```auto
$ free -g
              total used free shared buff/cache available
Mem: 31 22 5 0 3 8
Swap: 39 0 39

```

What can I do to prevent this? Thanks!

---

<div class="post-metadata">

**Author:** ![zillag](https://avatars.discourse-cdn.com/v4/letter/z/ed655f/32.png) [@zillag](https://community.sonatype.com/u/zillag)\
**Post date:** [March 31, 2022, 5:07pm UTC](https://community.sonatype.com/t/nexus-docker-container-eating-up-all-of-my-hostss-memory/8452/2 "2022-03-31T17:07:21Z")

</div>

I’ll try this from [Docker Hub](https://hub.docker.com/r/sonatype/nexus3/)

```auto
docker run --rm -d -p 8081:8081 -e INSTALL4J_ADD_VM_PARAMS="-Xms6G -Xmx6G -XX:MaxDirectMemorySize=15530M" --name nexus -v nexus-data:/nexus-data sonatype/nexus3

```

---

<div class="post-metadata">

**Author:** ![zillag](https://avatars.discourse-cdn.com/v4/letter/z/ed655f/32.png) [@zillag](https://community.sonatype.com/u/zillag)\
**Post date:** [March 31, 2022, 5:47pm UTC](https://community.sonatype.com/t/nexus-docker-container-eating-up-all-of-my-hostss-memory/8452/3 "2022-03-31T17:47:28Z")

</div>

That didn’t help.

---

<div class="post-metadata">

**Author:** ![sli720](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@sli720](https://community.sonatype.com/u/sli720)\
**Post date:** [January 16, 2023, 3:58pm UTC](https://community.sonatype.com/t/nexus-docker-container-eating-up-all-of-my-hostss-memory/8452/4 "2023-01-16T15:58:24Z")

</div>

I have the same problem (running it in a container on Kubernetes/Docker) since I’ve upgraded to CentOS9. Nexus (v3.42.0) eats up all the memory after a few days till it gets killed by the OOM killer. I’ve set the Java runtime parameters according to the documentation but the memory went up till 70Gi again.

```auto
-Xms8G
-Xmx8G
-XX:+UseG1GC
-XX:MaxDirectMemorySize=35158M

```

Can it maybe be related to the ulimit for the number of open files? I’ve set it to around 1 million cause the documentation just said more than 65k?

---

<div class="post-metadata">

**Author:** ![mpiggott](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@mpiggott](https://community.sonatype.com/u/mpiggott)\
**Post date:** [January 17, 2023, 3:46pm UTC](https://community.sonatype.com/t/nexus-docker-container-eating-up-all-of-my-hostss-memory/8452/5 "2023-01-17T15:46:52Z")

</div>

This isn’t a widely reported problem we’ve heard of, if you’re a pro customer you should open a ticket.

As an OSS user you’d need to do a heap dump and use an analyzer try to figure out what is consuming the memory.

You should be careful if your instance is getting regularly killed as that can lead to database corruption. It may be worth looking into repairing it now as perhaps some corruption there is leading to the out of control memory usage.

---

<div class="post-metadata">

**Author:** ![sli720](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@sli720](https://community.sonatype.com/u/sli720)\
**Post date:** [February 8, 2023, 11:29pm UTC](https://community.sonatype.com/t/nexus-docker-container-eating-up-all-of-my-hostss-memory/8452/6 "2023-02-08T23:29:25Z")

</div>

What is the correct approach the repair the database? I’ve tried [Fix Sonatype Nexus OrientDB · GitHub](https://gist.github.com/marcelmaatkamp/123e8793e07a72a382d8d0e8d66bbd8f)?

It seems as everytime there is a bigger upload e.g. docker push the memory usage increases and stays there. Is that normal behaviour?
