gpt4 book ai didi

windows - Windows中Rabbitmq Docker容器的正确路径

转载 作者:行者123 更新时间:2023-12-02 19:22:52 25 4
gpt4 key购买 nike

我在docker-compose.yml文件中有一个RabbitMQ Docker容器。

  rabbit:
image: rabbitmq:3-management
ports:
- "15672:15672"
- "5672:5672"
- "61613:61613"
- "15674:15674"
volumes:
- ./enabled_plugins:/etc/rabbitmq/enabled_plugins
labels:
- "traefik.enable=true"
- "traefik.docker.network=default"
- "traefik.ws.port=15674"
- "traefik.ws.frontend.rule=PathPrefixStrip:/stomp/"
- "traefik.web.port=15672"
- "traefik.web.frontend.rule=PathPrefixStrip:/rabbit/"

问题是当我执行docker-compose up -d时,出现错误。
$ docker-compose up -d
Removing deploji-server_rabbit_1
deploji-server_postgres_1 is up-to-date
Starting 820ca92c591a_deploji-server_server_1 ...
Recreating 563cd247aa16_deploji-server_rabbit_1 ...
deploji-server_traefik_1 is up-to-date
Recreating 563cd247aa16_deploji-server_rabbit_1 ... error
Starting 98268bf1b8a7_deploji-server_worker_1 ... done

ERROR: for 563cd247aa16_deploji-server_rabbit_1 Cannot start service rabbit: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/c/Projects/deploji-server/enabled_plugins\\\" to rootfs \\\"/mnt/sda1/var/lib/docker/overlay2/bfcfb23713669e206d402b6c3a183d772750b527f35e5d0372d4f6982ddeb56aStarting 820ca92c591a_deploji-server_server_1 ... done
tmq/enabled_plugins\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

ERROR: for rabbit Cannot start service rabbit: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/c/Projects/deploji-server/enabled_plugins\\\" to rootfs \\\"/mnt/sda1/var/lib/docker/overlay2/bfcfb23713669e206d402b6c3a183d772750b527f35e5d0372d4f6982ddeb56a/merged\\\" at \\\"/mnt/sda1/var/lib/docker/overlay2/bfcfb23713669e206d402b6c3a183d772750b527f35e5d0372d4f6982ddeb56a/merged/etc/rabbitmq/enabled_plugins\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
Encountered errors while bringing up the project.

在Linux环境中,似乎只有Windows才没有问题。我认为enabled_plugins文件的路径不正确。我试图将映射更改为类似
  • ./enabled_plugins:/c/rabbitmq

  • 并且该容器似乎已启动,但是服务器没有响应,因此我猜未正确安装enabled_plugins文件中的插件。

    整个docker-compose.yml文件可以在这里看到: https://github.com/maxmeister/deploji-server/blob/master/docker-compose.yml

    关于如何使其在Windows计算机上可以正常运行的任何建议?提前致谢。

    最佳答案

    我建议遵循docs:
    如果使用短语法,则有几种选择:

    SHORT SYNTAX Optionally specify a path on the host machine (HOST:CONTAINER), or an access mode (HOST:CONTAINER:ro).

    You can mount a relative path on the host, that expands relative to the directory of the Compose configuration file being used. Relative paths should always begin with . or ...


    volumes:
    # Just specify a path and let the Engine create a volume
    - /var/lib/mysql

    # Specify an absolute path mapping
    - /opt/data:/var/lib/mysql

    # Path on the host, relative to the Compose file
    - ./cache:/tmp/cache

    # User-relative path
    - ~/configs:/etc/configs/:ro

    # Named volume
    - datavolume:/var/lib/mysql

    相关 question和答案

    关于windows - Windows中Rabbitmq Docker容器的正确路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58511653/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com