I am trying to run a Shopware Image locally. When I execute the init.sh file from the dnhsoft repo the command stucks at
Waiting for mysql server...
I already tried different images. It just wont work for me.
I used this docker-compose.yml:
version: "2"
services:
shop:
image: dnhsoft/shopware:5.6.9
links:
- mysql:db
- mailhog
ports:
- "8000:80"
volumes:
- "./../mtsTheme:/shopware/themes/Frontend/mtsTheme"
- "./../Local:/shopware/engine/Shopware/Plugins/Local"
mysql:
image: mysql:5.7
ports:
- "3306"
volumes:
## this makes the mysql shopware friendly, otherwise we have some utf8 issues
# - "./docker/mysql/mysqld_charset.cnf:/etc/mysql/conf.d/mysqld_charset.cnf"
- "./volumes/mysql:/var/lib/mysql"
environment:
MYSQL_ROOT_PASSWORD: 123456
TZ: Europe/Berlin
pma:
image: phpmyadmin/phpmyadmin:4.8
links:
- mysql:db
ports:
- "8001:80"
environment:
PMA_USER: root
PMA_PASSWORD: 123456
TZ: Europe/Berlin
mailhog:
image: mailhog/mailhog
expose:
- "1025"
- "8025"
ports:
- "8025:8025"
environment:
TZ: Europe/Berlin
Related
In the image above the extra folders in the public folder only appears when ever i set up a dev environment with docker, the logs go to these folders instead of the /storage/logs/.
Another thing i experience when i use docker dev environment is i always have to reload cache (artisan optimize) before my config or route changes can be applied in the container.
THIS IS MY Docker-Compose FILE
version: "3"
networks:
laravel:
services:
nginx:
container_name: testproj-nginx
image: nginx:stable-alpine
ports:
- "2022:80"
volumes:
- ./:/var/www/html
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- php
- mysql
networks:
- laravel
mysql:
image: mysql:8
container_name: testproj-mysql
restart: unless-stopped
tty: true
ports:
- "2306:3306"
volumes:
- ./mysql:/var/lib/mysql
environment:
MYSQL_DATABASE: testproj
MYSQL_USER: root_user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: password
SERVICE_TAGS: dev
SERVICE_NAME: mysql
networks:
- laravel
php:
build: ./
container_name: testproj-php
volumes:
- ./:/var/www/html
networks:
- laravel
mailhog:
image: "mailhog/mailhog:latest"
container_name: testproj-mailhog
ports:
- "${FORWARD_MAILHOG_PORT:-2025}:1025"
- "${FORWARD_MAILHOG_DASHBOARD_PORT:-9025}:8025"
networks:
- laravel
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: testproj-pma
links:
- mysql
environment:
PMA_HOST: testproj-mysql
PMA_PORT: 3306
PMA_ARBITRARY: 1
restart: always
ports:
- 8083:80
networks:
- laravel
depends_on:
- php
- mysql
# ngrok:
# image: wernight/ngrok:latest
# container_name: testproj-ngrok
# ports:
# - 4041:4040
# environment:
# NGROK_AUTH: ${NGROK_AUTH_KEY}
# NGROK_REGION: eu
# NGROK_PROTOCOL: http
# NGROK_PORT: testproj-nginx:80
# networks:
# - laravel
# depends_on:
# - nginx
I have a WP project with following docker-compose configuration. When I try to connect my http://localhost to access the installation, I get 500 and I read this in the log:
PHP Fatal error: Uncaught mysqli_sql_exception: Connection refused in /var/www/html/web/wp/wp-includes/wp-db.php
I assume there is something wrong with the ip or the host but the weird thing is that phpmyadmin is working fine, and it connects with mysql without issues.
version: '3.9'
services:
nginx:
image: nginx:latest
container_name: ${APP_NAME}-nginx
ports:
- '80:80'
volumes:
- "./nginx/:/etc/nginx/templates/"
- ./src:/var/www/html:rw,cached
- ./certs:/etc/certs
environment:
- "NGINX_ENVSUBST_TEMPLATE_SUFFIX=.conf"
- "DOMAIN=${DOMAIN}"
depends_on:
- wordpress
restart: always
mysql:
image: mariadb:latest
container_name: ${APP_NAME}-mysql
command: --lower_case_table_names=2
volumes:
- './data/db:/var/lib/mysql:delegated'
environment:
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
- MYSQL_DATABASE=${DB_NAME}
restart: always
ports:
- '3307:3306'
wordpress:
build:
context: .
dockerfile: Dockerfile
container_name: ${APP_NAME}-wordpress
volumes:
- ./src:/var/www/html:rw,cached
- ./config/php.ini:/usr/local/etc/php/conf.d/php.ini
environment:
XDEBUG_ENABLED: 1
XDEBUG_CONFIG: remote_host=host.docker.internal
PHP_IDE_CONFIG: serverName=localhost
env_file:
- src/.env
depends_on:
- mysql
restart: always
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: ${APP_NAME}-phpmyadmin
volumes:
- ./config/phpmyadmin.ini:/usr/local/etc/php/conf.d/phpmyadmin.ini
environment:
PMA_HOST: "${DB_HOST}"
PMA_PORT: 3306
MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}"
ports:
- '8083:80'
links:
- mysql:mysql
mailhog:
container_name: ${APP_NAME}-mailhog
image: mailhog/mailhog
ports:
- "8025:8025"
- "1025:1025"
composer:
image: composer
container_name: ${APP_NAME}-composer
working_dir: /var/www/html
restart: 'no'
volumes:
- ./src:/var/www/html:rw,cached
My wordpress .env, among the other settings, set the host like the following:
DB_HOST="mysql:3307"
But I also tried
DB_HOST="mysql:3306"
or simply
DB_HOST="mysql"
Do you have any suggestions?
Thanks.
your Wordpress Instance and MySQL Instance isn't connected. Try adding networks on the docker-compose.yml
nginx:
...
networks:
- your-network-name
mysql:
...
networks:
- your-network-name
wordpress:
...
networks:
- your-network-name
and on the bottom of the file add:
networks:
your-network-name:
driver: bridge
this is the way to configure docker to be connected each other
I am quite new to docker and have been battling two days to get my system going. My compose file creates nginx, php-fpm, mysql and phpmyadmin containers. I can ping all containers from each other. But when I try installing anything from my mounted public_html volume into the database (like installing an app that needs to create tables in database), the app simply cannot connect to the database. I have made sure over and over credentials are correct. For the life of me I don't know where I'm going wrong. Any help would be greatly appreciated. I include my compose file below:
version: '3'
services:
www:
container_name: site1-www
image: nginx:1.13.7-alpine
expose:
- "80"
ports:
- 8001:80
networks:
datacentre:
aliases:
- site1www
env_file:
- ".env"
environment:
- NGINX_HOST=localhost
volumes:
- /mnt/www/site1.test/public_html:/usr/share/nginx/html/
-
/mnt/www/site1.test/conf/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- db
links
- db
phpfpm:
build: ./phpfpm
container_name: site1-phpfpm
networks:
datacentre:
aliases:
- site1php
volumes:
- /mnt/www/site1.test/public_html:/usr/share/nginx/html
- /mnt/www/site1.test/conf/php.ini:/usr/local/etc/php/php.ini
depends_on:
- db
links
- db
db:
container_name: site1-db
image: mariadb:10.3.2
ports:
- 3400:3306
env_file:
- ".env"
environment:
- MYSQL_DATABASE=test1db
- MYSQL_ROOT_PASSWORD=password
- MYSQL_USER=test1user
- MYSQL_PASSWORD=password
networks:
datacentre:
aliases:
- site1db
volumes:
- /mnt/dbdata:/var/lib/mysql
dbadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: site1-dbadmin
ports:
- 8000:80
networks:
datacentre:
aliases:
- site1dbadmin
environment:
- PMA_ARBITRARY=1
- PMA_HOST=mysql
depends_on:
- db
links
- db
networks:
datacentre:
external:
name: datacentre_net
The compose setup looks a bit complex for a first shot. Remove all the names and aliases and use service names for connections. Then build from there.
For the www service, nginx should configure phpfpm:9000 as the FastCGI worker.
Your PHP application and phpMyAdmin should be configured to connect to db:3306
version: '3'
services:
www:
image: nginx:1.13.7-alpine
ports:
- 8001:80
env_file:
- ".env"
environment:
- NGINX_HOST=localhost
volumes:
- /mnt/www/site1.test/public_html:/usr/share/nginx/html/
- /mnt/www/site1.test/conf/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- phpfpm
phpfpm:
build: ./phpfpm
volumes:
- /mnt/www/site1.test/public_html:/usr/share/nginx/html
- /mnt/www/site1.test/conf/php.ini:/usr/local/etc/php/php.ini
depends_on:
- db
db:
image: mariadb:10.3.2
ports:
- 3400:3306
env_file:
- ".env"
environment:
- MYSQL_DATABASE=test1db
- MYSQL_ROOT_PASSWORD=password
- MYSQL_USER=test1user
- MYSQL_PASSWORD=password
volumes:
- /mnt/dbdata:/var/lib/mysql
dbadmin:
image: phpmyadmin/phpmyadmin:latest
ports:
- 8000:80
environment:
- PMA_ARBITRARY=1
- PMA_HOST=db
depends_on:
- db
links are not required to access services on a user defined network.
I have a problem to getting php to call a python script. I donĀ“t know how I should get php to have access to python via exec.
Her is my yml file:
nginx:
build: ./nginx/
ports:
- 80:80
links:
- php
volumes_from:
- app
php:
build: ./php/
expose:
- 9000
links:
- mysql
volumes_from:
- app
app:
image: php:7.0.11-fpm
volumes:
- ./src:/var/www/html
command: "true"
mysql:
image: mysql:latest
volumes_from:
- data
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: project
MYSQL_USER: project
MYSQL_PASSWORD: project
data:
image: mysql:latest
volumes:
- /var/lib/mysql
command: "true"
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- 8888:80
links:
- mysql
environment:
PMA_HOST: mysql
Should I add a python container also? Or whats best here?
I've been this last two weeks searching how to link my phpmyadmin and my database, to create a PHP development workspace, through docker-compose but I am not able to connect to the database through the phpmyadmin port.
version: '3'
services:
servicio_php:
image: php:7.3-rc-apache
volumes:
- ./web/:/var/www/html
expose:
- "80"
ports:
- "80:80"
links:
- db
db:
image: mariadb:latest
restart: always
volumes:
- ./Volumenes/mysql:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root123
MYSQL_USER: user
MYSQL_PASSWORD: user123
MYSQL_DATABASE: bbdd1
expose:
- "3306"
ports:
- "3306:3306"
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: phpmyadmin
environment:
PMA_ARBITRARY: 1
MYSQL_ROOT_PASSWORD: root123
MYSQL_USERNAME: user
PMA_HOST: db
MYSQL_PASSWORD: user123
restart: always
ports:
- "8080:80"
volumes:
- ./sessions:/sessions/
depends_on:
- db
links:
- db
I am using windows 10 version of dockers 18.06.1-ce and also when i run docker-compose up i see there are some probles with Innodb but ive read is not a problem.
I am not able to see whats wrong and probably I am not the only one with this problem.