0

I get this error:

rabbit_mqtt_broker | Initializing ...
rabbit_mqtt_broker | sleep: invalid time interval ‘3\r’
rabbit_mqtt_broker | Try 'sleep --help' for more information.
rabbit_mqtt_broker exited with code 0

Dockerfile:

FROM rabbitmq:3-management

RUN mkdir -p /scripts
COPY init.sh /scripts
WORKDIR /scripts
RUN chmod +x init.sh
RUN rabbitmq-plugins enable rabbitmq_web_mqtt
ENTRYPOINT ["/bin/bash"]
CMD ["./init.sh"]

init.sh

#!/bin/sh
echo "Initializing ..."
sleep 3

To start I run

docker-compose up --build

Why am I getting this error?

  • 1
    From the error, I'm pretty sure your init.sh file has DOS/Windows line endings, which can cause all sorts of trouble. See: ["Are shell scripts sensitive to encoding and line endings?"](https://stackoverflow.com/questions/39527571/are-shell-scripts-sensitive-to-encoding-and-line-endings) – Gordon Davisson Nov 10 '21 at 17:52
  • 1
    As Gordon says, you have the saved your shell script with the wrong line ending convention - `\r` is the escape code for the Carriage Return character, used conventionally on DOS and Windows in the line-ending sequence `\r\n` (Carriage Return + Line Feed). The answers to the linked question explain this well. – IMSoP Nov 10 '21 at 17:54

0 Answers0