Running Cloudant as docker container with docker compose

浪子不回头ぞ 提交于 2019-12-12 03:59:25

问题


I am trying to use this image https://hub.docker.com/r/ibmcom/cloudant-developer/ with docker compose, when I use the original instructions it works, however when I translate it to docker compose format it doesn't work properly, I see the dashboard page but it is empty and seems broken.

The original run command:

docker run \
       --privileged \
       --detach \
       --volume cloudant:/srv \
       --name cloudant-developer \
       --publish 8080:80 \
       --hostname cloudant.dev \
       ibmcom/cloudant-developer 

The compose file I created:

version: '3'
services:
  cloudant:
    image: ibmcom/cloudant-developer:latest
    container_name: cloudant-developer
    hostname: cloudant.dev
    ports:
      - "8080:80"
    expose:
      - "80"
    volumes:
      - cloudant:/srv
    privileged: true
volumes:
  cloudant:

Thanks for helping.

P.S - I do executed the commands for license agreement manually


回答1:


Took me a while to figure this out. Turns out the cloudant docker container is tied to the default docker network subnet. Specifically, I found that haproxy was mapped to redirect to 172.17.0.2:5984 and was failing because by default docker compose creates a new network in a different ip range. There may be other issues related to this. Ultimately I found that you could run docker compose on the default docker network with the following config:

network_mode: bridge

So, your docker-compose.yml would look like this:

version: '3'
  services:
    cloudant:
      image: ibmcom/cloudant-developer:latest
      container_name: cloudant-developer
      hostname: cloudant.dev
      ports:
        - "8080:80"
      expose:
        - "80"
      volumes:
        - cloudant:/srv
      privileged: true
      network_mode: bridge
  volumes:
    cloudant:


来源:https://stackoverflow.com/questions/42745469/running-cloudant-as-docker-container-with-docker-compose

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!