Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Compose Mac Error: Cannot start service zoo1: Mounts denied:

I am getting the following error when running docker-compose up -d:

% docker-compose up -d

Creating network "kafka-test_default" with the default driver
Creating kafka-test_zoo1_1 ... error

ERROR: for kafka-test_zoo1_1  Cannot start service zoo1: Mounts denied: approving /Users/test/kafka-test/zk-single-kafka-single/zoo1/datalog: file does not exist

ERROR: for zoo1  Cannot start service zoo1: Mounts denied: approving /Users/test/kafka-test/zk-single-kafka-single/zoo1/datalog: file does not exist
ERROR: Encountered errors while bringing up the project.

It worked yesterday before I updated Docker for Mac multiple times to Docker version 20.10.0, build 7287ab3. Macbook is running Big Sur 11.0.1.

Note: It works if Docker is downgraded to 19.03.13. But this is not a good solution.


docker-compose.yml

Based on simplesteph/kafka-stack-docker-compose

version: '2.1'

services:
  zoo1:
    image: zookeeper:3.4.9
    hostname: zoo1
    ports:
      - "2181:2181"
    environment:
        ZOO_MY_ID: 1
        ZOO_PORT: 2181
        ZOO_SERVERS: server.1=zoo1:2888:3888
    volumes:
      - ./zk-single-kafka-single/zoo1/data:/data
      - ./zk-single-kafka-single/zoo1/datalog:/datalog

  kafka1:
    image: confluentinc/cp-kafka:5.5.1
    hostname: kafka1
    ports:
      - "9092:9092"
    environment:
      KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka1:19092,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
      KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181"
      KAFKA_BROKER_ID: 1
      KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
    volumes:
      - ./zk-single-kafka-single/kafka1/data:/var/lib/kafka/data
    depends_on:
      - zoo1version: '2.1'

services:
  zoo1:
    image: zookeeper:3.4.9
    hostname: zoo1
    ports:
      - "2181:2181"
    environment:
        ZOO_MY_ID: 1
        ZOO_PORT: 2181
        ZOO_SERVERS: server.1=zoo1:2888:3888
    volumes:
      - ./zk-single-kafka-single/zoo1/data:/data
      - ./zk-single-kafka-single/zoo1/datalog:/datalog

  kafka1:
    image: confluentinc/cp-kafka:5.5.1
    hostname: kafka1
    ports:
      - "9092:9092"
    environment:
      KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka1:19092,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
      KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181"
      KAFKA_BROKER_ID: 1
      KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
    volumes:
      - ./zk-single-kafka-single/kafka1/data:/var/lib/kafka/data
    depends_on:
      - zoo1
like image 874
Athena Wisdom Avatar asked Dec 10 '20 19:12

Athena Wisdom


2 Answers

UPDATE 2020-12-14:

This issue appears to be resolved in Docker Desktop 3.0.1 for Mac. If you disabled gRPC, you will likely want to enable it again after updating to 3.0.1.

Previous Answer:

I had this problem after updating to Docker Desktop 3.0.0 (for Mac). After going into Preferences and disabling Experimental Features -> Use gRPC FUSE for file sharing I was able to use volume mounts again.

like image 153
drewsign Avatar answered Oct 18 '22 00:10

drewsign


TL;DR: If you're on Docker Desktop 3.0.0, upgrade to 3.0.1 and you should be good.

I also had this problem after updating to Docker Desktop 3.0.0 for Mac. @drewsign's answer solved the problem for me, then I found the following resources explaining there was a bug in 3.0.0 -> so I upgraded to 3.0.1 and problem fixed!

Github issue here

Docker release notes for v3.0.1 here

To force your Docker Desktop app to update (on Mac), click the Whale Icon on the top toolbar, then "Check for Updates". After the update has installed, restart Docker. Now you should need to turn off "Experimental Features -> Use gRPC FUSE for file sharing"

like image 5
Blundering Philosopher Avatar answered Oct 18 '22 01:10

Blundering Philosopher