我正在尝试在Mac中启动Thingsboard Docker镜像。 我正在关注Mac中Docker的Thingsboard安装。 我在本地运行单节点cassandra实例作为docker镜像,并且cassandra实例已启动并运行。
admin@C02P111XG3QDMBP b2b-order-service (migration) $ cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>
当我启动Thingsboard Docker镜像时,ThingsBoard应用程序无法启动,因为它无法连接到cassandra。 以下是ThingsBoard的docker容器日志。
admin@C02P111XG3QDMBP installation $ docker logs 8f11b6e0605a
Selecting previously unselected package thingsboard.
(Reading database ... 25169 files and directories currently installed.)
Preparing to unpack /thingsboard.deb ...
Adding group `thingsboard' (GID 102) ...
Done.
Unpacking thingsboard (1.4.0-1) ...
Setting up thingsboard (1.4.0-1) ...
Wait for cassandra db to start...
Wait for cassandra db to start...
Wait for cassandra db to start...
Wait for cassandra db to start...
Wait for cassandra db to start...
Wait for cassandra db to start...
请帮我解决这个问题,因为它有助于开始使用ThingsBoard。
docker-compose.yml的内容如下所述。
version: '2'
services:
tb:
image: "thingsboard/application:1.4.0"
ports:
- "8080:8080"
- "1883:1883"
- "5683:5683/udp"
env_file:
- tb.env
environment:
- ADD_SCHEMA_AND_SYSTEM_DATA=${ADD_SCHEMA_AND_SYSTEM_DATA}
- ADD_DEMO_DATA=${ADD_DEMO_DATA}
volumes:
- "${HSQLDB_DATA_DIR}:/usr/share/thingsboard/data/sql"
entrypoint: /run-application.sh
cassandra:
image: "cassandra:3.11.2"
ports:
- "9042"
- "9160"
volumes:
- "${CASSANDRA_DATA_DIR}:/var/lib/cassandra"
zk:
image: "zookeeper:3.4.10"
ports:
- "2181"
restart: always
postgres:
image: "postgres:9.6"
ports:
- "5432"
environment:
- POSTGRES_DB=${POSTGRES_DB}
volumes:
- "${POSTGRES_DATA_DIR}:/var/lib/postgresql/data"
Cassandra实例在MAC主机上运行,而thingboard的docker容器在同一个MAC主机上运行。
答案 0 :(得分:2)
似乎Docker容器无法解析MAC VM主机的本地主机。所以我替换了CASSANDRA_HOST = host.docker.internal,它能够连接到主机MAC VM上localhost上运行的cassandra。