skip to Main Content

I’m trying to run Redis and ElasticSearch containers on windows server 2019. But I get error.

Here is my docker compose :

version: '3.7'

services:

  redis:
    image: redis:alpine
    command: redis-server --appendonly yes
    command: redis-server --requirepass 1234Abcd?!
    ports:
     - "6339:6379"
    volumes:
      - /volumes/redis/data:/data
    networks:
     - marketland 

  elasticsearch:
   image: elasticsearch:7.6.2
   volumes:
     - /volumes/elastic/data:/usr/share/elasticsearch/data
   volumes:
      - "esdata:/usr/share/elasticsearch/data"
   hostname: elasticsearch
   ports:
     - "9200:9200"
   environment:
     - discovery.type=single-node
     - bootstrap.memory_lock=true
   ulimits:
      memlock:
        soft: -1
        hard: -1
   networks:
     - marketland
     
  kibana:
   image: kibana:7.6.2
   ports:
     - "5601:5601"
   depends_on:
      - elasticsearch
   environment:
     - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
     - SERVER_NAME=kibana
   networks:
     - marketland
networks:
  marketland:
    external: true
volumes:
  esdata:

and after execute docker-compose -f docker-compose-pre up, I get this error :

Creating services_redis_1 ...
Creating services_elasticsearch_1 ... error
Creating services_redis_1         ... error
ERROR: for services_elasticsearch_1  Cannot create container for service elasticsearch: invalid option: Windows does not support Ulimits

ERROR: for services_redis_1  Cannot create container for service redis: failed to start service utility VM (createreadwrite): hcsshim::CreateComputeSystem 6821998c02d7861bd5fd6ca679dedcf30f9de574485632daed57d8fc872ae323_svm: The virtual machine could not be started because a required feature is not installed.
(extra info: {"SystemType":"container","Name":"6821998c02d7861bd5fd6ca679dedcf30f9de574485632daed57d8fc872ae323_svm","Layers":null,"HvPartition":true,"HvRuntime":{"ImagePath":"C:\Program Files\Linux Containers","LinuxInitrdFile":"initrd.img","LinuxKernelFile":"kernel"},"ContainerType":"linux","TerminateOnLastHandleClosed":true})

ERROR: for elasticsearch  Cannot create container for service elasticsearch: invalid option: Windows does not support Ulimits

ERROR: for redis  Cannot create container for service redis: failed to start service utility VM (createreadwrite): hcsshim::CreateComputeSystem 6821998c02d7861bd5fd6ca679dedcf30f9de574485632daed57d8fc872ae323_svm: The virtual machine could not be started because a required feature is not installed.
(extra info: {"SystemType":"container","Name":"6821998c02d7861bd5fd6ca679dedcf30f9de574485632daed57d8fc872ae323_svm","Layers":null,"HvPartition":true,"HvRuntime":{"ImagePath":"C:\Program Files\Linux Containers","LinuxInitrdFile":"initrd.img","LinuxKernelFile":"kernel"},"ContainerType":"linux","TerminateOnLastHandleClosed":true})
ERROR: Encountered errors while bringing up the project.

Is there any way to run these containers on Windows Server 2019 ?

** Hyper-v has already enabled.

3

Answers


  1. You cannot set ulimit in windows. Remove below lines:

    ulimits:
          memlock:
            soft: -1
            hard: -1
    

    It will only solve your elasticsearch problem.
    I recommend to try to use docker on linux.

    Login or Signup to reply.
  2. I’m using windows10/Home and Linux Container, the docker-complse.yml below works fine for me, try it

    version: '3.1'
    
    services:
      redis:
        image: redis:alpine
        container_name: redis
        restart: always
        ports: 
          - 6379:6379
        volumes:
          - ./redis-data:/usr/share/Redis/data
    
      elastic_search:
        container_name: ElasticSearch
        image: docker.elastic.co/elasticsearch/elasticsearch:7.10.2
        ports:
          - 9200:9200
        volumes:
          - ./es-data/:/usr/share/elasticsearch/data
        environment: 
        - discovery.type=single-node
          
          
    
    Login or Signup to reply.
  3. As per hamid bayat remove ulimits.

    The container-to-host volume bindings for both the redis & ElasticSearch containers also looks incorrect for Windows. See this SO for how the volumes should be defined in Windows. e.g.

    Instead of:

    volumes:
       /volumes/elastic/data:/usr/share/elasticsearch/data
    

    should be something like:

    volumes:
       - "C:/volumes/elastic/data:/usr/share/elasticsearch/data"
    

    Note: you’ve also got duplicate volumes in the ElasticSearch container – you can put both under a single one e.g.

    Instead of:

    volumes:
       - /volumes/elastic/data:/usr/share/elasticsearch/data
    volumes:
       - "esdata:/usr/share/elasticsearch/data"
    

    Should be:

    volumes:
       - /volumes/elastic/data:/usr/share/elasticsearch/data
       - "esdata:/usr/share/elasticsearch/data"
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search