【问题标题】:Docker Compose in Bluemix KeyError MessageBluemix KeyError 消息中的 Docker Compose
【发布时间】:2017-04-19 12:17:53
【问题描述】:

使用 docker-compose 在 Bluemix 中部署 2 个服务时出现错误:

Creating xxx

ERROR: for xxx-service 'message'
Traceback (most recent call last):
  File "bin/docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 64, in main
  File "compose/cli/main.py", line 116, in perform_command
  File "compose/cli/main.py", line 876, in up
  File "compose/project.py", line 416, in up
  File "compose/parallel.py", line 66, in parallel_execute
KeyError: 'message'
Failed to execute script docker-compose

我的 docker-compose 文件(在本地完美运行)是:

yyy-service:
    image: yyy
    container_name: wp-docker
    hostname: wp-docker 
    ports:
      - 8080:80
    environment:
      WORDPRESS_DB_PASSWORD: whatever
    volumes:
      - "~/whatever/:/var/www/html/wp-content"
    links:
         - xxx-service

xxx-service:
    image: xxx
    container_name: wp-mysql
    hostname: wp-mysql
    environment:
      MYSQL_ROOT_PASSWORD: whatever
      MYSQL_DATABASE: whatever
      MYSQL_USER: root
      MYSQL_PASSWORD: whatever
    volumes:
        - /var/data/whatever:/var/lib/mysql

这个问题和this one很相似,但是我看不到解决办法,除了尝试

export COMPOSE_HTTP_TIMEOUT=300

这对我没有用。

【问题讨论】:

    标签: docker containers ibm-cloud docker-compose


    【解决方案1】:

    不幸的是,docker-compose 吃掉了返回的实际错误消息,并为您提供了他们的 python 脚本的有用堆栈跟踪,但没有关于根本原因的信息。

    从您的撰写文件中,我猜问题出在您的卷上。您已指定它将计算主机上的目录直接挂载到容器中。这在 Bluemix 中不起作用 - 相反,您需要指定卷是外部的(并首先创建它们),然后指向它们。

    例如:

    version: '2'
    
    services:
        test:
          image: registry.ng.bluemix.net/ibmliberty
          volumes:
            - test:/tmp/data:rw
    
    volumes:
      test:
        external: true
    

    首先使用 cf ic volume create test 之类的内容创建卷(在本例中为“test”)

    【讨论】:

    • 谢谢@N Fritze,你是对的;问题出在卷上。我不得不修改您的解决方案,因为 Bluemix 当前不支持 docker-compose 版本“2”。见:stackoverflow.com/questions/36645126/…
    猜你喜欢
    • 1970-01-01
    • 2019-03-30
    • 2019-10-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-07
    • 2021-02-19
    • 1970-01-01
    相关资源
    最近更新 更多