Answer the question
In order to leave comments, you need to log in
Can't connect to Clickhouse from a container?
There is docker-compose with clickhouse:
clickhouse:
container_name: 'clickhouse'
image: yandex/clickhouse-server:latest
ports:
- "8123:8123"
- "9000:9000"
volumes:
- ./data/clickhouse/data:/var/lib/clickhouse
networks:
- lemp
php:
container_name: 'php'
image: nm-service:php7.4-fpm
build:
context: ./php
dockerfile: Dockerfile
networks:
- lemp
nginx:
container_name: 'nginx'
image: nginx:1.19-alpine
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
links:
- php
networks:
- lemp
$db = new ClickHouseDB\Client([
'host' => 'localhost', (или 127.0.0.1)
'port' => '8123',
'username' => 'default',
'password' => ''
]);
$db->ping();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question