docker 部署日志平台出错汇总

 第一次运行elasticsearch:8.11.1镜像,报错如下:

[root@master ~]# docker run --name es03 --net elastic -p 9200:9200 -it -m 1GB docker.elastic.co/elasticsearch/elasticsearch:8.11.1
docker: Error response from daemon: driver failed programming external connectivity on endpoint es03 (7e4d38400e1ee86e37bb258ccd4a74c9e863c065a46d79e1b197297d3b37b8f1): Bind for 0.0.0.0:9200 failed: port is already allocated.
ERRO[0000] error waiting for container:   

查看docker 里的镜像

[root@master ~]# docker images
REPOSITORY                                      TAG       IMAGE ID       CREATED         SIZE
docker.elastic.co/elasticsearch/elasticsearch   8.11.1    c1c64fbdab09   3 days ago      1.41GB
docker.elastic.co/kibana/kibana                 8.11.1    fda5cc289ef7   4 days ago      1.03GB
redis                                           latest    7614ae9453d1   23 months ago   113MB
hello-world                                     latest    feb5d9fea6a5   2 years ago     13.3kB
logstash                                        7.10.1    e7ae9aeccc0e   2 years ago     911MB
kibana                                          7.10.1    3e014820ee3f   2 years ago     992MB
elasticsearch                                   7.10.1    558380375f1a   2 years ago     774MB
docker.elastic.co/elasticsearch/elasticsearch   7.10.1    558380375f1a   2 years ago     774MB
store/elastic/filebeat                          7.10.1    63fab16fc008   2 years ago     426MB
mobz/elasticsearch-head                         5         b19a5c98e43b   6 years ago     824MB 

 第二次运行报错同样:

[root@master ~]# docker run --name es01 --net elastic -p 9200:9200 -it -m 1GB docker.elastic.co/elasticsearch/elasticsearch:8.11.1
docker: Error response from daemon: Conflict. The container name "/es01" is already in use by container "b928b38936dd040ecc9e9d6afee38919627546c7c7650e7b6db7a331848d92b8". You have to remove (or rename) that container to be able to reuse that name.

查看运行的docker镜像

[root@master ~]# docker ps
CONTAINER ID   IMAGE                                                  COMMAND                  CREATED          STATUS          PORTS                                                 NAMES
2b965270912c   docker.elastic.co/kibana/kibana:8.11.1                 "/bin/tini -- /usr/l…"   6 minutes ago    Up 6 minutes    0.0.0.0:5601->5601/tcp, :::5601->5601/tcp             kib01
dd5996e50ba7   fda5cc289ef7                                           "/bin/tini -- /usr/l…"   15 minutes ago   Up 15 minutes   5601/tcp                                              reverent_agnesi
b928b38936dd   docker.elastic.co/elasticsearch/elasticsearch:8.11.1   "/bin/tini -- /usr/l…"   4 hours ago      Up 23 minutes   0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 9300/tcp   es01
7633734299f8   mobz/elasticsearch-head:5                              "/bin/sh -c 'grunt s…"   5 days ago       Up 4 hours      0.0.0.0:9100->9100/tcp, :::9100->9100/tcp             elasticsearch-head

停止运行中的docker镜像文件 

[root@master ~]# docker stop 2b965270912c 

 镜像文件查看

[root@master ~]# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES 

第三次运行elasticsearch:8.11.1镜像 

docker run --name es01 --net elastic -p 9200:9200 -it -m 1GB docker.elastic.co/elasticsearch/elasticsearch:8.11.1 

如下图表示已经运行成功,且保存下面文件内容。 

docker 部署日志平台出错汇总_第1张图片

使用-m标志可以设置容器的内存限制。这样就不需要手动设置JVM大小。 

docker run -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -e ENROLLMENT_TOKEN="" --name es01 -p 9200:9200 --net elastic -it docker.elastic.co/elasticsearch/elasticsearch:8.11.1 

-----就是保存下来文件里的第一个密钥口令,如上图:Am-_WuVOCYKz*Q=dZyTd

docker run -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -e ENROLLMENT_TOKEN="Am-_WuVOCYKz*Q=dZyTd" --name es01 -p 9200:9200 --net elastic -it docker.elastic.co/elasticsearch/elasticsearch:8.11.1

你可能感兴趣的:(容器化部署,docker,容器,运维)