一、使用root帳號進入docker-solrjava
docker exec -it 127627ab6247 -u root /bin/bashdocker
二、安裝vimvim
apt-get updatecentos
apt-get install vimbash
三、修改配置文件rest
docker exec -it 127627ab6247 /bin/bashserver
cd /opt/solr/binblog
vim solr.in.shget
將:it
# Sets the port Solr binds to, default is 8983 SOLR_PORT=8983 改成 SOLR_PORT=$SOLR_PORT 或則其它端口號
其中:SOLR_PORT經過docker-compose.yml用environment設置:
solr-1: image: solr:6.4.1 ports: - "8981" network_mode: "host" container_name: solr-1 restart: always environment: ZK_HOST: devserver:2171,devserver:2181,devserver:2191 SOLR_PORT: 8981
四、在宿主機提交容器solr1爲新的鏡像,命名爲centos-self-solr
docker commit solr-1 solrcloud-1 docker commit solr-2 solrcloud-2 docker commit solr-3 solrcloud-3