Deploying MQTT EMQX docker on Fly.io (dockerfile & logs included)

Hi All,

I’m trying to run a basic docker container on a fly machine but getting some errors I havent come across. The application is also constantly restarting.

Here’s a dockerfile in-use:

# Dockerfile
FROM emqx:latest as cc-emqx

# Set environment variables
ENV EMQX_LISTENERS__SSL__DEFAULT__BIND=8883
ENV EMQX_DASHBOARD__LISTENERS__HTTP__ENABLE=true
ENV EMQX_DASHBOARD__LISTENERS__HTTP__BIND=18083
ENV EMQX_DASHBOARD__LISTENERS__HTTPS__ENABLE=true
ENV EMQX_DASHBOARD__LISTENERS__HTTPS__BIND=18084
ENV EMQX_DASHBOARD__DEFAULT_USERNAME=xxx
ENV EMQX_DASHBOARD__DEFAULT_PASSWORD=yyy

# Copy certificates
COPY . .

# Expose ports
EXPOSE 1883 8083 8084 8883 18083 18084

# Healthcheck
HEALTHCHECK --interval=5s --timeout=25s --retries=5 CMD /opt/emqx/bin/emqx ctl status

# Command to run
CMD ["emqx", "start"]

I’ve also attached the error log. You will notice a marked area which shows the application got started EMQX 5.6.1 is started successfully only to follow by additional error. Have also not been able to access this application via the flydev url.

Hi @bwoodlt ! I’m not familiar with EMQX, but looks like emqx start command will run the process in the background end exit, which will make init to kill the VM.
Could you please try running emqx foreground instead? Let me know how it goes.

2 Likes

Thanks @aschiavo
That did fix the issue!

1 Like

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