我对docker和magento都是新手,我正在尝试在docker上安装magento2。
我得到一个错误:´无法连接elasticsearch服务器:在群集中找不到活动节点´
我尝试了几个解决方案,从谷歌搜索的文字错误。
在我的“docker compose.yml”中,我尝试使用--elasticsearch host='127.0.0.1'--elasticsearch port='81'而不是--elasticsearch host='es01'
这是我的docker-compose.yml
version: '3'
services:
web:
image: webdevops/php-apache-dev:7.4
container_name: web
restart: always
user: application
environment:
- WEB_ALIAS_DOMAIN=local.xxx.dk
- WEB_DOCUMENT_ROOT=/app/pub
- PHP_DATE_TIMEZONE=EST
- PHP_DISPLAY_ERRORS=1
- PHP_MEMORY_LIMIT=2048M
- PHP_MAX_EXECUTION_TIME=300
- PHP_POST_MAX_SIZE=500M
- PHP_UPLOAD_MAX_FILESIZE=1024M
volumes:
- /Users/jonasborneland/Documents/magento:/app:cached
ports:
- "80:80"
- "443:443"
- "32823:22"
links:
- mysql
mysql:
image: mariadb:10.4
container_name: mysql
restart: always
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=magento
volumes:
- db-data:/var/lib/mysql
phpmyadmin:
container_name: phpmyadmin
restart: always
image: phpmyadmin/phpmyadmin:latest
environment:
- MYSQL_ROOT_PASSWORD=root
- PMA_USER=root
- PMA_PASSWORD=root
ports:
- "8080:80"
links:
- mysql:db
depends_on:
- mysql
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
container_name: es01
environment:
- node.name=es01
- cluster.name=es-docker-cluster
- cluster.initial_master_nodes=es01
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data01:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- elastic
volumes:
db-data:
external: false
data01:
driver: local
networks:
elastic:
driver: bridge
以下是我在web容器中用于设置magento的文件,它会导致错误:
php bin/magento setup:install \
--admin-firstname=JJ \
--admin-lastname=xxx \
--admin-email=xxx@xxx.com \
--admin-user=admin \
--admin-password='xxx!' \
--base-url=https://local.xxx.dk \
--base-url-secure=https://local.xxx.dk \
--backend-frontname=admin \
--db-host=mysql \
--db-name=magento \
--db-user=root \
--db-password=root \
--use-rewrites=1 \
--language=da_DK \
--currency=DKK \
--timezone=Europe/Copenhagen \
--use-secure-admin=1 \
--admin-use-security-key=1 \
--session-save=files \
--use-sample-data \
--elasticsearch-host=127.0.0.1 \
--elasticsearch-port=9200 \
--elasticsearch-username=admin \
--elasticsearch-password=xxx
1条答案
按热度按时间camsedfj1#
我想补充一点
更喜欢这个:https://github.com/markshust/docker-magento/blob/master/compose/docker-compose.yml
至于setup:install,执行: