# Issues with RabbitMQ in Singularity container

**URL:** <https://aiida.discourse.group/t/issues-with-rabbitmq-in-singularity-container/89>\
**Category:** General Usage\
**Created:** [September 8, 2023, 10:07am UTC](https://aiida.discourse.group/t/issues-with-rabbitmq-in-singularity-container/89 "2023-09-08T10:07:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mbercx](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/mbercx/32/345_2.png) [@mbercx](https://aiida.discourse.group/u/mbercx)\
**Post date:** [September 8, 2023, 10:07am UTC](https://aiida.discourse.group/t/issues-with-rabbitmq-in-singularity-container/89/1 "2023-09-08T10:07:39Z")

</div>

One of our users was experiencing some trouble starting the RabbitMQ server inside a Singularity container, see the following post on the (deprecated) mailing list:

[https://groups.google.com/g/aiidausers/c/VocNFWL-pBk/m/d3Wv6hTvAwAJ](https://groups.google.com/g/aiidausers/c/VocNFWL-pBk/m/d3Wv6hTvAwAJ)

I’m reposting the question below. Maybe @jusong.yu has some ideas as our resident container expert?

> We are facing some issues during building singularity image (apptainer version 1.1.2-1.el7) of AiiDA v2.3.1, while installing and running the rabbitmq-server. We have tried using rabbitmq-server-3.8.3 but we cannot start the rabbitmq, when we are trying to start the server using

```auto
  rabbitmq-server -detached

```

> there is no message that the server started. and when we do verdi status, we are getting the following error:

```auto
Unable to connect to rabbitmq with URL: amgp://guest: guest@127.0.0.1:5672?heartbeat=600
Error: ConnectionError: [Erro 111] Connect call failed ('127.0.0.1', 5672)

```

---

<div class="post-metadata">

**Author:** ![ltalirz](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/ltalirz/32/11_2.png) [@ltalirz](https://aiida.discourse.group/u/ltalirz)\
**Post date:** [September 8, 2023, 11:06pm UTC](https://aiida.discourse.group/t/issues-with-rabbitmq-in-singularity-container/89/2 "2023-09-08T23:06:13Z")

</div>

Not a rabbitmq expert but here are some thoughts on things to try.

Maybe try starting it without `-detached` and look at the output to know whether it works?

Once you know this, check e.g. with `ps -ef` whether the rabbitmq-server process continues running after `rabbitmq-server -detached`

If that is the case, check whether the port is reachable, e.g. via `nc -v 127.0.0.1 5672`

I don’t know whether localhost==127.0.0.1 in your singularity container - if not, that may explain it.

---

<div class="post-metadata">

**Author:** ![jusong.yu](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/jusong.yu/32/3_2.png) [@jusong.yu](https://aiida.discourse.group/u/jusong.yu)\
**Post date:** [September 9, 2023, 2:10pm UTC](https://aiida.discourse.group/t/issues-with-rabbitmq-in-singularity-container/89/3 "2023-09-09T14:10:06Z")

</div>

@mbercx Thanks for moving the discussion to discourse.

Hi @rita021989, sorry for the late reply. From my experience with singularity, it can [use docker image to create container](https://apptainer.org/docs/user/main/docker_and_oci.html#public-containers). Did you create a image from scratch and install aiida-core and RMQ/PostgreSQL? We now have a new docker image that handles these two services inside the container. Maybe you can give it a try.  
To pull the image with apptainer (or singularity) you can run:

```console
apptainer run docker://aiidateam/aiida-core-with-services:edge

```
