Skip to content

Mounting volume + RABBITMQ_NODENAME env var crashes the container #6

@vovimayhem

Description

@vovimayhem

I saw this: when mounting a host directory into /var/lib/rabbitmq, setting the "Node Name" with RABBITMQ_NODENAME environment variable crashes the container when re-generated.

# Create a dir to mount to the container:
cd /tmp && mkdir -p my-rabbit-vol

# Create the first container & attach to log:
docker run -d -e RABBITMQ_NODENAME=my-rabbit -v /tmp/my-rabbit-vol:/var/lib/rabbitmq --name my-rabbit rabbitmq:latest && docker logs -f my-rabbit

# Hit CTRL+C and destroy container:
docker stop my-rabbit && docker rm -v -f my-rabbit

# Create again the container with the same node name, and watch it crash:
docker run -d -e RABBITMQ_NODENAME=my-rabbit -v /tmp/my-rabbit-vol:/var/lib/rabbitmq --name my-rabbit rabbitmq:latest && docker logs -f my-rabbit

This behavior is not observed when the node name is set with the --hostname option:

# Hit CTRL+C and destroy the previous example container:
docker stop my-rabbit && docker rm -v -f my-rabbit

# Create the first container & attach to log:
docker run -d --hostname my-rabbit -v /tmp/my-rabbit-vol:/var/lib/rabbitmq --name my-rabbit rabbitmq:latest && docker logs -f my-rabbit

# Hit CTRL+C and destroy container:
docker stop my-rabbit && docker rm -v -f my-rabbit

# Create again the container with the same node name, and watch it go smoothly:
docker run -d --hostname my-rabbit -v /tmp/my-rabbit-vol:/var/lib/rabbitmq --name my-rabbit rabbitmq:latest && docker logs -f my-rabbit

Checking the logs, this is the difference:

Log output extract when --hostname option is set:

=INFO REPORT==== 31-Jan-2015::17:09:47 ===
node           : rabbit@my-rabbit
home dir       : /var/lib/rabbitmq
config file(s) : /etc/rabbitmq/rabbitmq.config
cookie hash    : qOtdWaDzvgKk6z1GifpTzw==
log            : undefined
sasl log       : undefined
database dir   : /var/lib/rabbitmq/mnesia/rabbit@my-rabbit # <- Watch this value in the next example

Log output extract when RABBITMQ_NODENAME is set:

=INFO REPORT==== 31-Jan-2015::17:13:03 ===
node           : my-rabbit@1d4ff08db83a
home dir       : /var/lib/rabbitmq
config file(s) : /etc/rabbitmq/rabbitmq.config
cookie hash    : qOtdWaDzvgKk6z1GifpTzw==
log            : undefined
sasl log       : undefined
database dir   : /var/lib/rabbitmq/mnesia/my-rabbit

I heavily suspect this is not the expected behavior (please confirm it)

I'll fork & check it out anyways :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions