i make an error on the point youmas:
environment:
XDEBUG_CONFIG: remote_host=172.17.0.1 remote_port=9000 remote_enable=1
networks:
- youmas
but i dont know how to fix them
version: "3"
services:
#PHP
youmas-app:
build:
context: .
dockerfile: Dockerfile
args:
- WITH_XDEBUG=true
image: youmas-app
container_name: youmas-app
restart: unless-stopped
tty: true
environment:
SERVICE_NAME: app
SERVICE_TAGS:
dev
# If you down want to use xDebug, set remote_enable=0
PHP_IDE_CONFIG: "serverName=Docker"
XDEBUG_CONFIG: remote_host=192.168.178.33 remote_port=9001
working_dir: /var/www
volumes:
- ./:/var/www
- ./docker/production/php/local.ini:/usr/local/etc/php/conf.d/local.ini
youmas:
environment:
XDEBUG_CONFIG: remote_host=172.17.0.1 remote_port=9000 remote_enable=1
networks:
- youmas
#Nginx
youmas-webserver:
build:
context: .
dockerfile: "./docker/production/nginx/Dockerfile"
container_name: youmas-webserver
restart: unless-stopped
tty: true
ports:
- "80:80"
- "443:443"
volumes:
- ./:/var/www
- ./docker/production/nginx/conf.d/:/etc/nginx/conf.d/
- ./docker/production/certbot/conf:/etc/letsencrypt
- ./docker/production/certbot/www:/var/www/certbot
networks:
- youmas
command: '/bin/sh -c ''while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g "daemon off;"'''
# Certbot SSL
certbot:
image: certbot/certbot
volumes:
- ./docker/production/certbot/conf:/etc/letsencrypt
- ./docker/production/certbot/www:/var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
#MySQL
youmas-database:
image: mysql:5.7.22
container_name: youmas-database
restart: unless-stopped
tty: true
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: youmas
MYSQL_ROOT_PASSWORD: K4#|ahdpof8##!~
SERVICE_TAGS: dev
SERVICE_NAME: mysql
volumes:
- dbdata:/var/lib/mysql/
- ./docker/production/mysql/my.cnf:/etc/mysql/my.cnf
networks:
- youmas
#PHP My Admin
youmas-phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- "7000:80"
links:
- youmas-database:youmas-database
environment:
MYSQL_USER: root
MYSQL_PASSWORD: codeverze
MYSQL_ROOT_PASSWORD: codeverze
networks:
- youmas
#Networks
networks:
youmas:
driver: bridge
#Volumes
volumes:
dbdata:
driver: local
any solution?
Your Syntax is wrong,
Replace the environment section to look like this :
youmas-app:
build:
context: .
...
...
...
environment:
- 'SERVICE_NAME=app'
- 'SERVICE_TAGS=dev'
...
...
Related
Can anybody help me with the following? I have a docker-compose file with the following services PHP, Mysql, Redis, and Nginx. The docker-compose file builds without any issues but when I try the URL its not working. The file is down below
version: '3.8'
services:
php:
build: ./docker-compose/php-81/build
image: php-81
container_name: cumax-php-db
restart: unless-stopped
working_dir: /var/www/
volumes:
- ./:/var/www
- ./docker-files/storage/logs/php:/var/www/default/logs
networks:
- onboarding
db:
image: mysql:8.0
container_name: cumax-mysql-db
restart: unless-stopped
environment:
MYSQL_DATABASE: ${DB_DATABASE}
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
MYSQL_PASSWORD: ${DB_PASSWORD}
MYSQL_USER: ${DB_USERNAME}
SERVICE_TAGS: dev
SERVICE_NAME: mysql
volumes:
- ./docker-compose/mysql8.0/storage:/var/lib/mysql
networks:
- onboarding
nginx:
image: nginx:1.17-alpine
container_name: cumax-nginx
restart: unless-stopped
ports:
- "8070:80"
volumes:
- ./:/var/www
- ./docker-compose/nginx/conf.d:/etc/nginx/conf.d
networks:
- onboarding
redis:
image: "redis:alpine"
ports:
- "6379:6379"
networks:
- onboarding
networks:
onboarding:
On php you don't publish the port.
On the Nginx you only publish to port 8070 on the host.
What is the URL you are using? It should be http://< host >:8070/
And then the nginx should proxy onwards to php.
I'm using WordPress in Docker with the following configuration:
# /wp-dock/docker-compose.yml
---
version: "3.3"
services:
db:
container_name: ${APP_NAME}-wordpress-db
image: "mysql:5.7"
platform: linux/amd64
volumes:
- "./data/mysql:/var/lib/mysql"
restart: always
ports:
- 18766:3306
environment:
- MYSQL_DATABASE=${DB_NAME}
- MYSQL_USER=${DB_USER}
- MYSQL_PASSWORD=${DB_PASSWORD}
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
restart: always
ports:
- "8080:80"
environment:
- PMA_HOST=db
wordpress:
container_name: ${APP_NAME}-wordpress
depends_on:
- db
image: "wordpress:latest"
ports:
- "81:80"
environment:
WORDPRESS_DB_HOST: "db:3306"
WORDPRESS_DB_NAME: ${DB_NAME}
WORDPRESS_DB_USER: ${DB_USER}
WORDPRESS_DB_PASSWORD: ${DB_PASSWORD}
volumes:
- "./wordpress:/var/www/html"
- "./plugins:/var/www/html/wp-content/plugins"
- "./themes:/var/www/html/wp-content/themes"
wpcli:
container_name: ${APP_NAME}-cli
depends_on:
- wordpress
image: wordpress:cli-php8.1
user: 1000:1000
command: tail -f /dev/null
volumes:
- "./wordpress:/var/www/html"
environment:
WORDPRESS_DB_HOST: "db:3306"
WORDPRESS_DB_NAME: ${DB_NAME}
WORDPRESS_DB_USER: ${DB_USER}
WORDPRESS_DB_PASSWORD: ${DB_PASSWORD}
I can access and use wp-cli like so:
docker exec site-cli wp --info
This works well. But I'm writing a plugin in the WordPress container that extends the wp-cli with a custom command as seen here.
When I try run that command, wp-cli says that it's not a registered command.
Any ideas on how to extend wp-cli in a Docker container?
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 am working on a laravel php application which seemed to running fine until I stopped working for the day by running the docker-compose down command. When I got back to working again by starting the container docker-compose up -d, the container started throwing a failed connecting to udp error. Below is the error I am getting
In my logs I can see some message
[2022-09-07 07:25:09] local.ERROR: Failed connecting to udp://: (0: Failed to parse address ":") {"exception":"[object] (UnexpectedValueException(code: 0): Failed connecting to udp://: (0: Failed to parse address ":") at /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php:313)
Because of the error php exits and I can do practically nothing with the app at this point. Does anyone know how I can deal with the issue and get php state back to running?
Below is my docker file
# For more information: https://laravel.com/docs/sail
version: '3'
services:
gateway:
build:
context: services/vendor/laravel/sail/runtimes/7.4
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-7.4/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '8000:80'
- '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
volumes:
- './gateway:/var/www/html'
networks:
- sail
depends_on:
- db1
- redis
- mailhog
services:
build:
context: servvices/vendor/laravel/sail/runtimes/8.1
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.1/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '8002:80'
- '${VITE_PORT:-5175}:${VITE_PORT:-5173}'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
volumes:
- './loans:/var/www/html'
networks:
- sail
depends_on:
- gateway
- db2
# gateway db
db1:
image: 'mysql/mysql-server:8.0'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${GATEWAY_DB_PASSWORD}'
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: '${GATEWAY_DB_DATABASE}'
MYSQL_USER: '${GATEWAY_DB_USERNAME}'
MYSQL_PASSWORD: '${GATEWAY_DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 1
volumes:
- 'spg_db:/var/lib/mysql'
- './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
networks:
- sail
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-p${GATEWAY_DB_PASSWORD}"]
retries: 3
timeout: 5s
# service db
db2:
image: 'mysql/mysql-server:8.0'
ports:
- '3308:3306'
environment:
MYSQL_ROOT_PASSWORD: '${SERVICE_DB_PASSWORD}'
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: '${SERVICE_DB_DATABASE}'
MYSQL_USER: '${SERVICE_DB_USERNAME}'
MYSQL_PASSWORD: '${SERVICE_DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 1
volumes:
- 'spl_db:/var/lib/mysql'
- './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
networks:
- sail
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-p${SERVICE_DB_PASSWORD}"]
retries: 3
timeout: 5s
redis:
image: 'redis:alpine'
ports:
- '${FORWARD_REDIS_PORT}:6379'
volumes:
- 'redis:/data'
networks:
- sail
healthcheck:
test: ["CMD", "redis-cli", "ping"]
retries: 3
timeout: 5s
mailhog:
image: 'mailhog/mailhog:latest'
ports:
- '${FORWARD_MAILHOG_PORT:-1025}:1025'
- '${FORWARD_MAILHOG_DASHBOARD_PORT:-8025}:8025'
networks:
- sail
networks:
sail:
driver: bridge
volumes:
db1:
driver: local
db2:
driver: local
redis:
driver: local
i have laravel project and i want to create docker for it
and i want to automation it
i want to run this commends:
{
php artisan key:generate
php artisan migrate
php artisan queue:work --daemon
}
and its my docker-compose.yml file
version: '3'
services:
#PHP Service
app:
build:
context: .
dockerfile: Dockerfile
image: xxxx/lumen:Library
container_name: Library
restart: unless-stopped
tty: true
environment:
SERVICE_NAME: app
SERVICE_TAGS: dev
working_dir: /var/www
volumes:
- ./:/var/www
networks:
- app-network
#Nginx Service
webserver:
image: nginx:alpine
container_name: LibraryWebserver
restart: unless-stopped
tty: true
ports:
- "80:80"
- "443:443"
volumes:
- ./:/var/www
- ./nginx/conf.d/:/etc/nginx/conf.d/
networks:
- app-network
#MySQL Service
db:
image: mysql:5.7.22
container_name: Librarydb
restart: unless-stopped
tty: true
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: library
MYSQL_ROOT_PASSWORD: Library!23
MYSQL_USER: root
MYSQL_PASSWORD: Library!23
SERVICE_TAGS: dev
SERVICE_NAME: mysql
networks:
- app-network
volumes:
- dbdata:/var/lib/mysql
#Docker Networks
networks:
app-network:
driver: bridge
#Volumes
volumes:
dbdata:
driver: local
i try to use command: php artisan migrate and its do nothing
and also use
command: bash -c "php artisan migrate"
command: 'php artisan migrate'
You can use a command like the below example. It will run the command once the container is up and running.
version: "3.0"
services:
app:
image: busybox
command: top
networks:
app_net:
link_local_ips:
- 57.123.22.11