3

I'm running the following container using the docker image for the Confluent Schema Registry. Everything runs fine inside the container meaning I can run a shell command inside the container against localhost:8081/subjects and get an empty list back as expected.

However, I'm trying to spin up the Schema Registry in a container just so I could build an application locally that points to this schema registry instance. So I tried exposing port 8081 to my local machine. But localhost:8081 is not accessible from my machine. Is there no way to do what I'm trying to do here? I tried running the schema registry without docker on my windows machine but I didn't see a windows specific schema-registry-start file.

docker run -d \
  --net=host \
  --add-host=linuxkit-00155da9f301:127.0.0.1 \
  -p 8081:8081 \
  --name=schema-registry \
  -e SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL=iptozookeepernode1:2181,iptozookeepernode2:2181 \
  -e SCHEMA_REGISTRY_HOST_NAME=localhost \
  -e SCHEMA_REGISTRY_LISTENERS=http://localhost:8081 \
  -e SCHEMA_REGISTRY_DEBUG=true \
  confluentinc/cp-schema-registry:latest
Marius Waldal
  • 9,537
  • 4
  • 30
  • 44
emirhosseini
  • 545
  • 2
  • 8
  • 17
  • Are you using Docker for Kafka, Zookeeper etc too? If so, have you looked at Docker Compose? This makes things like networking a ton easier – Robin Moffatt Mar 13 '19 at 09:38
  • @RobinMoffatt I'm not. I have an Azure HDInsight Kafka cluster for that and I'm just trying to write some code with the Schema Registry running locally pointed at the Kafka cluster that I already have out there. That part of it actually works because the registry fires up properly within the container. I just can't access it from outside the container. – emirhosseini Mar 13 '19 at 13:37
  • 1
    @emirhosseini Did you ever solve this problem? I'm having the same problem using docker-compose. When running my app through docker it can connect to the schema registry, but when run through an integration test from outside the container network, it fails. – Eoin May 29 '20 at 09:52

1 Answers1

3

For me, the issue was related to port 8081 on localhost (used by McAfee), changed port mapping to 8017:8081 and it's working fine.

Mattia Fantoni
  • 889
  • 11
  • 15