Hello and good afternoon,
let’s recap what the command
docker run -it confluentinc/cp-kafka-connect /bin/bash is doing:
run => start a container
confluentinc/cp-kafka-connect => based on this image
-it => run an interactive terminal in the container (see Docker run reference | Docker Documentation)
/bin/bash => instead of the command intended by the creator if the image use this command (see Docker run reference | Docker Documentation)
Alltogether this results in a shell in a container based on an image where the command intended by the image’s creator is not used.
If the command for a container exits the whole container is stopped. So if you exit this shell the container stops. That is working as designed.
I guess you want to create a container based on
confluentinc/cp-kafka-connect and then have an interactive terminal into this container.
So first start the container and let it run in the background with
docker run -d confluentinc/cp-kafka-connect
then find out the container’s name or id with
docker ps -a
and now you can have an interactive terminal into this running container with
docker exec -it <containername|containerid> /bin/bash
If you exit this shell the container is still running in the background .