title: Kafka Connect in Docker container: Connector not added
body: <p>I'm trying to get a simple Kafka Connect container running. I did try the <a href="https://docs.confluent.io/5.0.0/installation/docker/docs/installation/connect-avro-jdbc.html" rel="nofollow noreferrer">Confluent Connect Tutorial</a>, but have a slightly different setup (no docker machine, no schema registry).</p>
  
  <p>For the time being, I'm working with a Docker compose setup containing Zookeeper and Kafka.</p>
  
  <pre><code>version: '3.1'
  services:
    zookeeper:
      image: confluentinc/cp-zookeeper
      ports:
        - 2181
      environment:
        - ZOOKEEPER_CLIENT_PORT=2181
        - ZOOKEEPER_TICK_TIME=2000
        - ZOOKEEPER_SYNC_LIMIT=2
    kafka:
      image: confluentinc/cp-kafka
      depends_on:
        - zookeeper
      ports:
        - 9092
        - 9094:9094
      environment:
        - KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
        # setup :9092 for access inside the docker network, 9094 for outside (ie host)
        - KAFKA_LISTENERS=INTERNAL://kafka:9092,OUTSIDE://kafka:9094
        - KAFKA_ADVERTISED_LISTENERS=INTERNAL://kafka:9092,OUTSIDE://localhost:9094
        - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,OUTSIDE:PLAINTEXT
        - KAFKA_INTER_BROKER_LISTENER_NAME=INTERNAL
        - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
        - KAFKA_NUM_PARTITIONS=10
  </code></pre>
  
  <p>That works fine for different uses, so I don't expect this to be a problem.</p>
  
  <p>Now I'm starting a Kafka Connect container which connects fine to Kafka. I use the following command which is adapted from the Connect Tutorial:</p>
  
  <pre><code>docker run -d \
    --name=kafka-connect-test \
    --net=kafka-connect_default \
    --expose 28083 \
    -p 28083:28083 \
    -e CONNECT_BOOTSTRAP_SERVERS=kafka:9092 \
    -e CONNECT_REST_PORT=28083 \
    -e CONNECT_GROUP_ID="quickstart-test" \
    -e CONNECT_CONFIG_STORAGE_TOPIC="quickstart-test-config" \
    -e CONNECT_OFFSET_STORAGE_TOPIC="quickstart-test-offsets" \
    -e CONNECT_STATUS_STORAGE_TOPIC="quickstart-test-status" \
    -e CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR=1 \
    -e CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR=1 \
    -e CONNECT_STATUS_STORAGE_REPLICATION_FACTOR=1 \
    -e CONNECT_KEY_CONVERTER="org.apache.kafka.connect.storage.StringConverter" \
    -e CONNECT_VALUE_CONVERTER="org.apache.kafka.connect.storage.StringConverter" \
    -e CONNECT_INTERNAL_KEY_CONVERTER="org.apache.kafka.connect.storage.StringConverter" \
    -e CONNECT_INTERNAL_VALUE_CONVERTER="org.apache.kafka.connect.storage.StringConverter" \
    -e CONNECT_REST_ADVERTISED_HOST_NAME="localhost" \
    -e CONNECT_LOG4J_ROOT_LOGLEVEL=DEBUG \
    -e CONNECT_PLUGIN_PATH=/usr/share/java/kafka,/etc/kafka-connect/jars \
    -v /tmp/quickstart/file:/tmp/quickstart \
    -v /tmp/quickstart/jars:/etc/kafka-connect/jars \
    confluentinc/cp-kafka-connect:latest
  </code></pre>
  
  <p>The most notable difference is that I'm using the <code>StringConverter</code>, because I'd like to use <code>kafkacat</code> to insert test data.</p>
  
  <p>The container starts up fine and is running and reachable on all the exposed endpoints I tried.
   Since I didn't add any connectors, I query the available ones:</p>
  
  <p><code>localhost:28083/connector-plugins</code>:</p>
  
  <pre><code>[
    {
      "class": "org.apache.kafka.connect.file.FileStreamSinkConnector",
      "type": "sink",
      "version": "5.4.0-ccs"
    },
    {
      "class": "org.apache.kafka.connect.file.FileStreamSourceConnector",
      "type": "source",
      "version": "5.4.0-ccs"
    },
    {
      "class": "org.apache.kafka.connect.mirror.MirrorCheckpointConnector",
      "type": "source",
      "version": "1"
    },
    {
      "class": "org.apache.kafka.connect.mirror.MirrorHeartbeatConnector",
      "type": "source",
      "version": "1"
    },
    {
      "class": "org.apache.kafka.connect.mirror.MirrorSourceConnector",
      "type": "source",
      "version": "1"
    }
  ]
  </code></pre>
  
  <p>So for now it would be enough for me to create a file sink that writes data from a topic to a file. I POST to <code>localhost:28083/connectors</code></p>
  
  <pre><code>{ "name": "file-sink", 
   "config": { 
       "connector.class": "org.apache.kafka.connect.file.FileStreamSinkConnector",
       "tasks.max": 1, 
       "file": "/test.sink.txt",
       "topics": "test-topic"
   }
  }
  </code></pre>
  
  <p>and receive <code>201 - Created</code>.</p>
  
  <p>However, when querying that endpoint with <code>GET</code>, I get an empty array as a response. Trying around, I can also change the <code>connector.class</code> to <code>FileStreamSinkConnector</code> or just <code>FileStreamSink</code> and will still get a <code>201</code> (without a connector being added).</p>
  
  <p>What am I doing wrong?</p>
  
  <p>And why am I getting "success" responses when something obviously went wrong?</p>