在 Docker 中使用 RabbitMQ 删除容器 [英] Dropping container with RabbitMQ in Docker

查看:20
本文介绍了在 Docker 中使用 RabbitMQ 删除容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试用 RabbitMQ 启动一个 Docker 容器,结果下载了镜像,但是容器没有启动.我在日志中收到以下消息:

I try to start a Docker container with RabbitMQ, as a result, the image is downloaded, but the container does not start. I get the following message in the logs:

error: RABBITMQ_DEFAULT_PASS is set but deprecated
error: RABBITMQ_DEFAULT_USER is set but deprecated
error: RABBITMQ_DEFAULT_VHOST is set but deprecated
error: RABBITMQ_ERLANG_COOKIE is set but deprecated
error: deprecated environment variables detected

这个问题是最近出现的,在此之前一切正常并开始.

This problem appeared recently, before that everything worked fine and started.

这是我的 docker-compose 兔子:

This is my docker-compose rabbit:

rabbit:
    image: "rabbitmq:3-management"
    hostname: "rabbit"
    environment:
        RABBITMQ_ERLANG_COOKIE: 'SWQOKODSQALRPCLNMEQGW'
        RABBITMQ_DEFAULT_USER: 'user'
        RABBITMQ_DEFAULT_PASS: 'bitnami'
        RABBITMQ_DEFAULT_VHOST: '/'
    ports:
        - "15672:15672"
        - "5672:5672"
    labels:
        NAME: "rabbitmq"    
    networks:
        - postgres

推荐答案

最近更新了最新的RabbitMQ稳定docker镜像(3.9),官方镜像页面说:

The latest stable docker image for RabbitMQ (3.9) has been recently updated and the official image page says:

As of RabbitMQ 3.9, all of the docker-specific variables listed below are deprecated and no longer used.

我已经通过以下方式解决了这个问题:

I have resolved the issue in following way:

  1. 在 docker compose 所在的同一个文件夹中创建一个 rabbitmq.conf 文件文件存在

  1. Create a rabbitmq.conf file in the same folder where docker compose file is present

按照此处.比如:

default_vhost = /
default_user = user
default_pass = bitnami

  • 在 docker compose 文件中,放置 volumes 部分而不是 environment 部分并将 rabbitmq.conf 文件安装到正确的路径(取决于操作系统,请遵循这里).对于 linux 容器,它将是这样的:

  • In docker compose file, instead of an environment section put a volumes section and mounted the rabbitmq.conf file to proper path (depending on OS, follow here). For linux container it will be like:

    rabbit:
        image: "rabbitmq:3-management"
        hostname: "rabbit"
        volumes:
          - "./rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf"
        ports:
          - "15672:15672"
          - "5672:5672"
        labels:
          NAME: "rabbitmq"    
        networks:
          - postgres
    

  • 这篇关于在 Docker 中使用 RabbitMQ 删除容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆