在docker中运行ElasticSearch时报错:docker: invalid reference format: repository name must be lowercase.

遇到问题

在用docker启动ElasticSearch容器时输入

docker run --name elasticsearch -p 9200:9200 -p 9300:9300\
-e "discovery.type=single-node"\
-e ES_JAVA_OPTS="-Xms64m -Xmx128m"\
-v /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml\
-v /mydata/elasticsearch/data:/usr/share/elasticsearch/data\
-v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins\
-d elasticsearch:7.6.2

报错

docker: invalid reference format: repository name must be lowercase.

原因:

Docker:无效的引用格式:存储库名称必须小写。

shell中的 \ 前没有加空格

解决:

在所有 \ 前加 空格,修改完后如下:

docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms64m -Xmx128m" \
-v /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /mydata/elasticsearch/data:/usr/share/elasticsearch/data \
-v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.6.2

运行成功

posted @ 2021-11-27 15:38  事有回响  阅读(905)  评论(0编辑  收藏  举报