简体   繁体   中英

docker-compose bitnami kafka container I have no name

I'm trying to get a kafka instance going inside a docker container. The docker-compose.yml looks like this:

version: '2'

services:
  zookeeper:
    image: 'bitnami/zookeeper:3'
    ports:
      - '2181:2181'
    volumes:
      - 'zookeeper_data:/bitnami'
    environment:
      - ALLOW_ANONYMOUS_LOGIN=yes
  kafka:
    image: 'bitnami/kafka:2'
    ports:
      - '9092:9092'
    volumes:
      - 'kafka_data:/bitnami'
    environment:
      - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
      - ALLOW_PLAINTEXT_LISTENER=yes
      - KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092
      - KAFKA_CREATE_TOPICS=A_TOPIC,ANOTHER_TOPIC
    depends_on:
      - zookeeper

volumes:
  zookeeper_data:
    driver: local
  kafka_data:
    driver: local

The container gives no evident errors when I run docker-compose up . However, when I connect to the container's shell

docker exec -it [container] /bin/bash

I see

I have no name!@7fe183af5e2a:/$

where 7fe183af5e2a is the container.

Any reason for I have no name! ? Am I missing something simple?

If you look at the Dockerfile for the Kafka image (the Zookeeper one is similar), you'll see that the user used in the container is the one with the uid 1001 .

So when you see I have no name.@... , this simply means that there is no user mapped to the uid 1001. You can verify that if you look into the file /etc/passwd you won't see any entry for a user with the id 1001.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM