大佬教程收集整理的这篇文章主要介绍了在 windows server 2019 上运行 linux 容器,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试在 windows Server 2019 上运行 redis 和 ElasticSearch 容器。但出现错误。
这是我的 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:
在执行 docker-compose -f docker-compose-pre up 后,我收到此错误:
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","TerminateOnLastHandleClosed":truE})
ERROR: Encountered errors while bringing up the project.
有没有办法在 windows Server 2019 上运行这些容器?
** Hyper-v 已启用。
@H_944_0@解决方法你不能在 windows.remove 下面的行中设置 ulimit:
ulimits:
memlock:
soft: -1
hard: -1
它只是解决您的弹性搜索问题。 我建议尝试在 linux 上使用 docker。
,我使用的是 windows10/Home 和 Linux Container,下面的 docker-complse.yml
对我来说很好用,试试吧
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
,
根据 hamid bayat 删除 ulimits
。
redis 和 ElasticSearch 容器的容器到主机卷绑定在 Windows 中看起来也不正确。有关如何在 Windows 中定义卷的信息,请参阅 this SO。例如
代替:
volumes:
/volumes/elastic/data:/usr/share/elasticsearch/data
应该是这样的:
volumes:
- "C:/volumes/elastic/data:/usr/share/elasticsearch/data"
注意:您在 ElasticSearch 容器中也有重复的 volumes
- 您可以将两者放在一个下,例如
代替:
volumes:
- /volumes/elastic/data:/usr/share/elasticsearch/data
volumes:
- "esdata:/usr/share/elasticsearch/data"
应该是:
volumes:
- /volumes/elastic/data:/usr/share/elasticsearch/data
- "esdata:/usr/share/elasticsearch/data"
以上是大佬教程为你收集整理的在 windows server 2019 上运行 linux 容器全部内容,希望文章能够帮你解决在 windows server 2019 上运行 linux 容器所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。