0

Scenario: I had my docker-compose.yml working as expected when I was using Docker Desktop For Windows (here is Windows 10 Pro). Since I had to use also Virtual Box + Minishift in same Notebook I read somewhere else recommending to uninstall Docker Desktop for Windows and install Docker Toolbox (basically because Docker Descktop rely on HyperV and I can't start Virtual Box & Minishift if I don't desable HyperV). So far so good. I mean, I successfully start minishift (OpenShift simplified version) and I successfully started docker.

The problem is that after I unistalled Docker For Windows and I installed Docker ToolBox I am getting the error pasted bellow.

It seems some issue while "mounting" the volumes or some problem with certain path but I can imagine what I may try to fix.

In case it matter, I add here also my entire docker-compose and all its yml and conf files dependency. If you want to reproduce, all files pasted bellow can be cloned from github

docker-compose.yml

version: '3.2'
services:
  kibana:
    image: docker.elastic.co/kibana/kibana:7.5.2
    volumes:
      - "./kibana.yml:/usr/share/kibana/config/kibana.yml"
    restart: always
    environment:
    - SERVER_NAME=kibana.localhost
    - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
    ports:
      - "5601:5601"
    links:
      - elasticsearch
    depends_on:
      - elasticsearch
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.5.2
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - xpack.security.enabled=false
      - xpack.watcher.enabled=false
      - discovery.type=single-node
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - "./esdata:/usr/share/elasticsearch/data"
    ports:
      - "9200:9200"
  logstash:
    image: docker.elastic.co/logstash/logstash:7.5.2
    volumes:
      - "./logstash.conf:/config-dir/logstash.conf"
    restart: always
    command: logstash -f /config-dir/logstash.conf
    ports:
      - "9600:9600"
      - "7777:7777"
    links:
      - elasticsearch
      - kafka1
      - kafka2
      - kafka3
  kafka1:
    image: wurstmeister/kafka
    command: [start-kafka.sh]
    depends_on:
      - zoo1
      - zoo2
      - zoo3
    links:
      - zoo1
      - zoo2
      - zoo3
    ports:
      - "9092:9092"
    environment:
      KAFKA_LISTENERS: PLAINTEXT://:9092
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka1:9092
      KAFKA_BROKER_ID: 1
      KAFKA_ADVERTISED_PORT: 9092
      KAFKA_LOG_RETENTION_HOURS: "168"
      KAFKA_LOG_RETENTION_BYTES: "100000000"
      KAFKA_ZOOKEEPER_CONNECT:  zoo1:2181,zoo2:2181,zoo3:2181
      KAFKA_CREATE_TOPICS: "log:3:3"
      KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
  kafka2:
    image: wurstmeister/kafka
    depends_on:
      - zoo1
      - zoo2
      - zoo3
    links:
      - zoo1
      - zoo2
      - zoo3
    ports:
      - "9093:9092"
    environment:
      KAFKA_LISTENERS: PLAINTEXT://:9092
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka2:9092
      KAFKA_BROKER_ID: 2
      KAFKA_ADVERTISED_PORT: 9092
      KAFKA_LOG_RETENTION_HOURS: "168"
      KAFKA_LOG_RETENTION_BYTES: "100000000"
      KAFKA_ZOOKEEPER_CONNECT:  zoo1:2181,zoo2:2181,zoo3:2181
      KAFKA_CREATE_TOPICS: "log:3:3"
      KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
  kafka3:
    image: wurstmeister/kafka
    depends_on:
      - zoo1
      - zoo2
      - zoo3
    links:
      - zoo1
      - zoo2
      - zoo3
    ports:
      - "9094:9092"
    environment:
      KAFKA_LISTENERS: PLAINTEXT://:9092
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka3:9092
      KAFKA_BROKER_ID: 3
      KAFKA_ADVERTISED_PORT: 9092
      KAFKA_LOG_RETENTION_HOURS: "168"
      KAFKA_LOG_RETENTION_BYTES: "100000000"
      KAFKA_ZOOKEEPER_CONNECT:  zoo1:2181,zoo2:2181,zoo3:2181
      KAFKA_CREATE_TOPICS: "log:3:3"
      KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
  zoo1:
    image: elevy/zookeeper:latest
    environment:
      MYID: 1
      SERVERS: zoo1,zoo2,zoo3
    ports:
      - "2181:2181"
  zoo2:
    image: elevy/zookeeper:latest
    environment:
      MYID: 2
      SERVERS: zoo1,zoo2,zoo3
    ports:
      - "2182:2181"
  zoo3:
    image: elevy/zookeeper:latest
    environment:
      MYID: 3
      SERVERS: zoo1,zoo2,zoo3
    ports:
      - "2183:2181"
  filebeat:
    image: docker.elastic.co/beats/filebeat:7.5.2
    volumes:
      - "./filebeat.yml:/usr/share/filebeat/filebeat.yml:ro"
      - "./sample-logs:/sample-logs"
    links:
      - kafka1
      - kafka2
      - kafka3
    depends_on:
      - kafka1
      - kafka2
      - kafka3

filebeat.yml

filebeat.inputs:

- paths:
    - /sample-logs/*.log
  tags:
    - request-sample
  input_type: log
  document_type: request-sample
  fields_under_root: true

output.kafka:
  hosts: ["kafka1:9092", "kafka2:9092", "kafka3:9092"]
  topic: 'log'
  partition.round_robin:
    reachable_only: false
  required_acks: 1
  compression: gzip
  max_message_bytes: 1000000

kibana.yml

server.name: kibana
server.host: "0"
xpack.monitoring.ui.container.elasticsearch.enabled: false
#opendistro_security.multitenancy.enabled: false
elasticsearch.ssl.verificationMode: none

logstash.conf

input {
  kafka {
    bootstrap_servers => "kafka1:9092,kafka2:9092,kafka3:9092"
    client_id => "logstash"
    group_id => "logstash"
    consumer_threads => 3
    topics => ["log"]
    codec => "json"
    tags => ["log", "kafka_source"]
    type => "log"
  }
}

filter {
  if [type] == "request-sample" {
    grok {
      match => { "message" => "%{COMMONAPACHELOG}" }
    }
    date {
      match => ["timestamp", "dd/MMM/yyyy:HH:mm:ss Z"]
      remove_field => ["timestamp"]
    }
  }
}

output {
  elasticsearch {
       hosts => ["elasticsearch:9200"]
       index => "logstash-%{[type]}-%{+YYYY.MM.dd}"
  }
  stdout { codec => rubydebug }
}

Logs trying docker-compose -up

SPANOT149+Cast@SPANOT149 MINGW64 /c/Dockers/megalog-try-1 (master)
$ docker-compose down                                                                                                   Stopping megalog-try-1_logstash_1 ... done                                                                              Stopping megalog-try-1_kafka2_1   ... done                                                                              Stopping megalog-try-1_kafka3_1   ... done                                                                              Stopping megalog-try-1_kafka1_1   ... done                                                                              Stopping megalog-try-1_zoo3_1     ... done                                                                              Stopping megalog-try-1_zoo2_1     ... done                                                                              Stopping megalog-try-1_zoo1_1     ... done                                                                              Removing megalog-try-1_logstash_1      ... done                                                                         Removing megalog-try-1_filebeat_1      ... done                                                                         Removing megalog-try-1_kibana_1        ... done                                                                         Removing megalog-try-1_kafka2_1        ... done                                                                         Removing megalog-try-1_kafka3_1        ... done                                                                         Removing megalog-try-1_kafka1_1        ... done                                                                         Removing megalog-try-1_zoo3_1          ... done                                                                         Removing megalog-try-1_elasticsearch_1 ... done                                                                         Removing megalog-try-1_zoo2_1          ... done                                                                         Removing megalog-try-1_zoo1_1          ... done                                                                         Removing network megalog-try-1_default

SPANOT149+Cast@SPANOT149 MINGW64 /c/Dockers/megalog-try-1 (master)
$ docker volume prune
WARNING! This will remove all local volumes not used by at least one container.
Are you sure you want to continue? [y/N] y
Deleted Volumes:
10a8f1ae070802866a7072ded8a65fb8cee80fbbcf527126869a69778089d514
f71c1e6bd951a256cf746d538528baa9f34b0da57ca628f03fbabbb1eb9c1133
0d8ed8cff8f2cdd1870f4f3757d15203432b9a549d13d9094c090a41f11e66c5

Total reclaimed space: 62.92MB

SPANOT149+Cast@SPANOT149 MINGW64 /c/Dockers/megalog-try-1 (master)
$ docker container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B

SPANOT149+Cast@SPANOT149 MINGW64 /c/Dockers/megalog-try-1 (master)
$ docker-compose up -d --remove-orphans
Creating network "megalog-try-1_default" with the default driver
Creating megalog-try-1_zoo3_1          ... done                                                                         Creating megalog-try-1_zoo2_1          ... done                                                                         Creating megalog-try-1_elasticsearch_1 ... done                                                                         Creating megalog-try-1_zoo1_1          ... done                                                                         Creating megalog-try-1_kafka3_1        ...
Creating megalog-try-1_kafka1_1        ...
Creating megalog-try-1_kafka2_1        ...
Creating megalog-try-1_kibana_1        ... error                                                                        
ERROR: for megalog-try-1_kibana_1  Cannot start service kibana: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/c/Dockers/Creating megalog-try-1_kafka3_1        ... done                                                                         Creating megalog-try-1_kafka1_1        ... done                                                                         Creating megalog-try-1_kafka2_1        ... done                                                                         ing to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
Creating megalog-try-1_logstash_1      ...
Creating megalog-try-1_filebeat_1      ... error                                                                        
ERROR: for megalog-try-1_filebeat_1  Cannot start service filebeat: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/c/Dockers/megalog-try-1/filebeat.yml\\\" to rootfs \\\"/mnt/sda1/var/lib/docker/overlay2/445ddec2e92149c077681b1daf3f0723dbc3c3f821541fb28252501ae122a4bf/merged\\\" at \\\"/mnt/sda1/var/lib/docker/overlay2/445ddec2e92149c077681b1daf3f0723dbc3c3f821541fb28252501ae122a4bf/merged/usr/share/filebeat/filebeat.yml\\\" caused \\\"not a directory\\\"\"": unknown: Are you Creating megalog-try-1_logstash_1      ... done                                                                         e

ERROR: for kibana  Cannot start service kibana: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/c/Dockers/megalog-try-1/kibana.yml\\\" to rootfs \\\"/mnt/sda1/var/lib/docker/overlay2/36dbfb01925aef8cc05376a57e88d2f7e3b85bd47af9549e13a9c4f5ad516ae3/merged\\\" at \\\"/mnt/sda1/var/lib/docker/overlay2/36dbfb01925aef8cc05376a57e88d2f7e3b85bd47af9549e13a9c4f5ad516ae3/merged/usr/share/kibana/config/kibana.yml\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

ERROR: for filebeat  Cannot start service filebeat: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/c/Dockers/megalog-try-1/filebeat.yml\\\" to rootfs \\\"/mnt/sda1/var/lib/docker/overlay2/445ddec2e92149c077681b1daf3f0723dbc3c3f821541fb28252501ae122a4bf/merged\\\" at \\\"/mnt/sda1/var/lib/docker/overlay2/445ddec2e92149c077681b1daf3f0723dbc3c3f821541fb28252501ae122a4bf/merged/usr/share/filebeat/filebeat.yml\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.

SPANOT149+Cast@SPANOT149 MINGW64 /c/Dockers/megalog-try-1 (master)
0

By default, Docker toolbox shares the c:\Users (case sensitive) directory into the VM for containers to access as volumes. You need to add additional shares in VirtualBox to the VM to mount other paths as a volume:

  1. Open the VirtualBox UI.

  2. Click the Settings gear, then go to Shared Folders.

  3. Select any existing listing under Machine Folders, then click the + icon.

    • Choose the Folder Path on the host, enter the Folder Name for within the VM (or take the default, which is the same name as on the host), and configure any additional options you need.

    • Choose Auto-mount if you want the folder to automatically be mounted into the VM, and choose Make Permanent for it to be considered a permanently shared folder.

  4. Click OK to add the new folder to the Shared Folders list.

  5. Click OK again to save your changes and exit the Settings dialog.

Reference: https://docs.docker.com/toolbox/toolbox_install_windows/#optional-add-shared-directories

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.