symfony-4-docker-env
symfony-4-docker-env copied to clipboard
Does not start
It does not start on my system... Windows 10 based...
php | standard_init_linux.go:207: exec user process caused "no such file or directory"
What now?
You have error from symfony
container due to previous error with php
container.
php
container exits because of Blackfire API error. You can register account on
https://blackfire.io/
and change keys in
https://github.com/tulik/symfony-docker/blob/master/.env
or remove Blackfire from image php
https://github.com/tulik/symfony-docker/blob/master/symfony/Dockerfile#L45 lines 45-50 and rebuild with docker-compose --build
(in this case you can remove blackfire container from docker-compose.yaml
too.)
OK, thanks. That seem to have worked. But now there is the next problem:
host not found
Can you attach dump of docker-compose logs php
?
Does this help?
Here is the docker-compose.yaml file... perhaps there is an issue? (again, I am on a Windows 10 system)
version: '3'
services:
php:
build:
context: ./symfony
container_name: php
depends_on:
- postgres
env_file:
- ./symfony/.env
# Comment out these volumes in production
volumes:
- ./symfony:/srv/symfony:rw,cached
# If you develop on Linux, comment out the following volumes to just use bind-mounted project directory from host
environment:
# If you develop on Windows change this to remote_host=docker.for.win.localhost
# If you develop on Linux change this to remote_host=172.17.0.1
XDEBUG_CONFIG: "remote_host=docker.for.win.localhost idekey=IDE_XDEBUG"
BLACKFIRE_CLIENT_ID: ${BLACKFIRE_CLIENT_ID}
BLACKFIRE_CLIENT_TOKEN: ${BLACKFIRE_CLIENT_TOKEN}
symfony:
build:
context: ./symfony
dockerfile: Dockerfile.nginx
container_name: symfony
depends_on:
- php
ports:
- "8080:80"
volumes:
- ./symfony/public:/srv/symfony/public:ro
postgres:
# In production, you may want to use a managed database service
image: postgres:9.6-alpine
container_name: postgres
environment:
- POSTGRES_DB=symfony
- POSTGRES_USER=symfony
- POSTGRES_PASSWORD=symfony
- PGDATA=/var/lib/postgresql/data/db-files/
volumes:
- db-data:/var/lib/postgresql/data:rw
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./docker/db/data:/var/lib/postgresql/data:rw
ports:
- "5432:5432"
# Optional mysql database - uncomment and replace "depends_on: [ postgres ] with mysql
# mysql:
# # In production, you may want to use a managed database service
# image: mariadb
# container_name: mysql
# environment:
# MYSQL_ROOT_PASSWORD: root
# MYSQL_USER: symfony
# MYSQL_PASSWORD: symfony
# command: --log-bin=/var/lib/mysql/mysql-bin.log --binlog-format=ROW --server-id=1 --init-file /var/mysql/data/init.sql
# # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# volumes:
# - ./symfony/docker/mysql:/var/mysql/data:ro
# - db-data:/var/lib/mysql:rw
adminer:
image: adminer
container_name: adminer
depends_on:
- postgres
restart: always
ports:
- 2000:8080
blackfire:
image: blackfire/blackfire
container_name: blackfire
depends_on:
- php
environment:
BLACKFIRE_SERVER_ID: ${BLACKFIRE_SERVER_ID}
BLACKFIRE_SERVER_TOKEN: ${BLACKFIRE_SERVER_TOKEN}
BLACKFIRE_LOG_LEVEL: 4
ports:
- "8707:8707"
h2-proxy:
# Don't use this proxy in prod
build:
context: ./h2-proxy
dockerfile: ./Dockerfile
container_name: h2-proxy
depends_on:
- symfony
ports:
- "80:80"
- "443:443"
volumes:
db-data: {}
In the file
symfony-docker\symfony\docker\nginx\conf.d
I inspected the file conf.d around line 11 and I changed
location ~ ^(/index\.php(/|$)|.blackfire.yml) {
# Comment the next line and uncomment the next to enable dynamic resolution (incompatible with Kubernetes)
fastcgi_pass php:9000;
#resolver 127.0.0.11;
to
location ~ ^(/index\.php(/|$)|.blackfire.yml) {
# Comment the next line and uncomment the next to enable dynamic resolution (incompatible with Kubernetes)
#fastcgi_pass php:9000;
resolver 127.0.0.11;
and now it works. But I would like to use Kubernetes.
Is there a way to work with Kubernetes or what else do you suggest to use for orchestration?
Also, when I open localhost, I get this:
404 Not Found nginx/1.13.12
Did you ever test everything on Windows?