// Module included in the following assemblies:
//
// assembly-using-kafka-connect-with-plugins.adoc

[id='creating-new-image-from-base-{context}']
= Creating a Docker image from the Kafka Connect base image

This procedure shows how to create a custom image and add it to the `/opt/kafka/plugins` directory.

You can use the Kafka container image on {DockerRepository} as a base image for creating your own custom image with additional connector plug-ins.

At startup, the {ProductName} version of Kafka Connect loads any third-party connector plug-ins contained in the `/opt/kafka/plugins` directory.

.Prerequisites

* xref:deploying-cluster-operator-str[The Cluster Operator must be deployed.]

.Procedure

. Create a new `Dockerfile` using `{DockerKafkaConnect}` as the base image:
+
[source,subs="+quotes,attributes"]
----
FROM {DockerKafkaConnect}
USER root:root
COPY ./_my-plugins_/ /opt/kafka/plugins/
USER {DockerImageUser}
----

. Build the container image.

. Push your custom image to your container registry.

. Point to the new container image.
+
You can either:
+
* Edit the `KafkaConnect.spec.image` property of the `KafkaConnect` custom resource.
+
If set, this property overrides the `STRIMZI_KAFKA_CONNECT_IMAGES` variable in the Cluster Operator.
+
[source,yaml,subs=attributes+]
----
apiVersion: {KafkaConnectApiVersion}
kind: KafkaConnect
metadata:
  name: my-connect-cluster
spec:
  #...
  image: my-new-container-image
----
+
or
+
* In the `install/cluster-operator/050-Deployment-strimzi-cluster-operator.yaml` file, edit the `STRIMZI_KAFKA_CONNECT_IMAGES` variable to point to the new container image, and then reinstall the Cluster Operator.

.Additional resources

* For more information on the `KafkaConnect.spec.image property`, see link:{BookURLUsing}#assembly-configuring-container-images-deployment-configuration-kafka-connect[Container images^].
* For more information on the `STRIMZI_KAFKA_CONNECT_IMAGES` variable, see link:{BookURLUsing}#ref-operators-cluster-operator-configuration-deploying-co[Cluster Operator Configuration^].
