Andrei Koch
Andrei Koch

Reputation: 1140

Can't connect from outside of container to Clickhouse by HTTP on Mac OS

I'm trying to use ClickHouse with docker on Mac OS. I use next command:

docker run -d -p 8123:8123 --rm --name some-clickhouse-server -v /my/config/path/config.xml:/etc/clickhouse-server/config.xml --ulimit nofile=262144:262144 yandex/clickhouse-server:latest

Container successfully started, but when I try to connect to it by http curl 'http://localhost:8123' I have an error:

Failed to connect to localhost port 8123: Connection refused

When I connect to Clickhouse from Clickhouse-client (also using docker image) everything is OK

I ran Clickhouse-server image in -it mode, installed curl, started server and tried to connect clickhouse-server from inside of container, it's OK too

Also I tried to modify config.xml (which was copied from docker image) settings for listen_host (::, 0.0.0.0, ::1, 127.0.0.1) and for every setting I tried to connect by curl for localhost, 127.0.0.1, 0.0.0.0 - nothing of this solved my problem

Upvotes: 3

Views: 2519

Answers (2)

Puneeth Reddy V
Puneeth Reddy V

Reputation: 1568

Normally, docker desktop write these details of host and container to /etc/hosts, after adding the clickhouse-service as follows has resolved this issue.

127.0.0.1 localhost clickhouse-service

Upvotes: 1

Andrei Koch
Andrei Koch

Reputation: 1140

I used Docker Toolbox on Mac OS (in conjunction with VirtualBox). So, I've migrated to Docker Desktop and this has solved my problem

Upvotes: 0

Related Questions