I have Ubuntu 20.04 machine and my docker version is 20.10.08. Following is my docker-compose file:
services:
zookeeper:
image: docker.io/bitnami/zookeeper:3.7
ports:
- "2181:2181"
volumes:
- "kafka-vol:/bitnami/kafka/config"
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
kafka:
image: docker.io/bitnami/kafka:3
ports:
- "9092:9092"
volumes:
- "kafka-vol:/bitnami/kafka/config"
environment:
- KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
- ALLOW_PLAINTEXT_LISTENER=yes
depends_on:
- zookeeper
volumes:
kafka-vol:
driver: local
driver_opts:
type: none
o: bind
device: /home/ned/advice/data/conf/kafka
I am using docker-compose
for running the containers. It is running fine with no errors but my configs of kafka are not mounting in the host directory. So far I have tried the following:
- Allowed the permission 1001 on the folder as mentioned in the bitnami docker image documentation.
- Gave relative path
.advice/data/conf/kafka
in the volumes - Gave full path direct in the volumes of the services as (without the double quotes as suggested in Docker Volume not mounting any files):
image: docker.io/bitnami/kafka:3
ports:
- "9092:9092"
volumes:
- advice/data/conf/kafka:/bitnami/kafka/config
When I do docker volume inspect kafka-vol
. It gave me the following output:
[
{
"CreatedAt": "2022-01-28T07:16:22Z",
"Driver": "local",
"Labels": {
"com.docker.compose.project": "ned",
"com.docker.compose.version": "2.2.3",
"com.docker.compose.volume": "kafka-vol"
},
"Mountpoint": "/var/snap/docker/common/var-lib-docker/volumes/ned_kafka-vol/_data",
"Name": "ned_kafka-vol",
"Options": {
"device": "/home/ned/advice/data/conf/kafka",
"o": "bind",
"type": "none"
},
"Scope": "local"
}
]
Now, I don't know what am I doing wrong that it isn't mounting my config files. The directory /home/ned/advice/data/conf/kafka
is empty. I was expecting docker's kafka config at this /home/ned/advice/data/conf/kafka
directory