I am runing a Symfony 3.4 application with docker, i need to upload a file and save it to /web/files. When i'm trying to do so i get an error:
Unable to create the "/home/docker/web/files/" directory
Note that i mounted the directory as Read-Write in cocker compose:
version: '2'
services:
front:
image: nginx
ports:
- "81:80"
links:
- "engine:engine"
- "db:db"
volumes:
- ".:/home/docker:ro"
- "./docker/front/default.conf:/etc/nginx/conf.d/default.conf:ro"
engine:
build: ./docker/engine/
volumes:
- ".:/home/docker:rw"
- "./docker/engine/php.ini:/usr/local/etc/php/conf.d/custom.ini:ro"
links:
- "db:db"
working_dir: "/home/docker"
db:
image: camptocamp/postgres:9.6
ports:
- "5433:5432"
environment:
- "POSTGRES_DB=pfe"
- "POSTGRES_PASSWORD=admin"
- "POSTGRES_USER=admin"
- "PGDATA=/var/lib/postgresql/data/pgdata"
I even created the directory files in /web, but its not working!
I create a separate container for my files, and just base it on an apache image. Then I use the volumes_from key to pass it into my php. Give something like this a try:
services:
apache:
build: ./build/httpd
links:
- php
ports:
- 80:80
- 443:443
volumes_from:
- app
php:
build: ./build/php
ports:
- 9000
- 9001
volumes_from:
- app
links:
- mariadb
- mail
app:
image: httpd:latest
volumes:
- ./:/var/www/html
command: "echo true"
Related
Hello all Connections Greeting,
I am using this repository https://github.com/markshust/docker-magento for magento2 installation with docker.
I installed magento 2.3.3 and configured php 7.3 in docker file.
Problem is installation is completed without any error but, I am getting unable to connect after every new installation in browser.
Please help if you facing this same issue.
Thank you in advance.
docker-compose.yml file
# Mark Shust's Docker Configuration for Magento
# (https://github.com/markshust/docker-magento)
#
# Version 34.2.0
version: "3"
services:
app:
image: markoshust/magento-nginx:1.18-4
ports:
- "8000:80"
- "8443:443"
links:
- db
- phpfpm
volumes: &appvolumes
- ~/.composer:/var/www/.composer:cached
- appdata:/var/www/html
- sockdata:/sock
- ssldata:/etc/nginx/certs
phpfpm:
image: markoshust/magento-php:7.3-fpm-0
links:
- db
volumes: *appvolumes
db:
image: percona:5.7
command: --max_allowed_packet=64M
ports:
- "8080:3306"
env_file: env/db.env
volumes:
- dbdata:/var/lib/mysql
redis:
image: redis:5.0-alpine
elasticsearch:
image: markoshust/magento-elasticsearch:7.6.2-2
ports:
- "9200:9200"
- "9300:9300"
environment:
- "discovery.type=single-node"
myadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
restart: always
volumes:
- dbdata:/var/lib/mysql
ports:
- "8082:80"
depends_on:
- db
rabbitmq:
image: rabbitmq:3.7-management-alpine
ports:
- "15672:15672"
- "5672:5672"
volumes:
- rabbitmqdata:/var/lib/rabbitmq
# Disabling cron by default as it uses higher CPU, enable if needed
#cron:
# image: markoshust/magento-php:7.4-fpm-2
# user: root
# command: /usr/local/bin/cronstart
# tty: true
# links:
# - db
# volumes: *appvolumes
volumes:
appdata:
dbdata:
rabbitmqdata:
sockdata:
ssldata:
I am running below commands step by step
git clone https://github.com/markshust/docker-magento.git
cd docker-magento & curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/template | bash
bin download 2.3.3 & then add host in host file
bin/setup myhost.com
successfully installed magento database also created success fully but I can not access through browser.
I'm using Docker to work with php projects.
When I try to change a file of a project on my host machine, PhpStorm says
Could someone please help me to configure the permissions so I could work with the files of my project on my host machine. I'm using Ubuntu 18.04
docker-compose.yml:
version: "3.1"
services:
mysql:
image: mysql:8.0
container_name: symtest-mysql
working_dir: /application
volumes:
- .:/application
environment:
- MYSQL_ROOT_PASSWORD=123
- MYSQL_DATABASE=symfony2
- MYSQL_PASSWORD=123
ports:
- "8084:3306"
webserver:
image: nginx:alpine
container_name: symtest-webserver
working_dir: /application
volumes:
- .:/application
- ./phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- "8082:80"
php-fpm:
build: phpdocker/php-fpm
container_name: symtest-php-fpm
working_dir: /application
volumes:
- .:/application
- ./phpdocker/php-fpm/php-ini-overrides.ini:/etc/php/7.2/fpm/conf.d/99-overrides.ini
UPD: This problem appeared after I generated a new entity inside the docker using bin/console command.
I'm using docker to run my website.
I built php-fpm container for php using.
Phpinfo shows this info in the browser:
Additional .ini files parsed
/usr/local/etc/php/conf.d/docker-php-ext-gd.ini,
/usr/local/etc/php/conf.d/docker-php-ext-mcrypt.ini,
/usr/local/etc/php/conf.d/docker-php-ext-mongodb.ini,
/usr/local/etc/php/conf.d/docker-php-ext-mysqli.ini,
/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini,
/usr/local/etc/php/conf.d/docker-php-ext-soap.ini,
/usr/local/etc/php/conf.d/docker-php-ext-zip.ini,
/usr/local/etc/php/conf.d/ext-xdebug.ini
But at the same time class_exists('MongoClient') returns false
My docker-compose.yml (that is not all services):
installer:
image: andreaskoch/dockerized-magento-installer
environment:
DOMAIN: dockerized-magento.local
volumes_from:
- nginx
volumes:
- ./config/installer/bin/install.sh:/bin/install.sh
links:
- "cache:rediscache"
- "sessions:redissession"
- "fullpagecache:redisfullpagecache"
- "solr:solr"
- "mysql:mysql"
- "mongodb:mongodb"
entrypoint: /bin/install.sh
nginx:
image: nginx:latest
ports:
- "80:80"
- "443:443"
links:
- "php"
volumes:
- ./logs/nginx:/var/log/nginx
volumes_from:
- php
php:
image: avestique/php7_fpm
links:
- "cache:rediscache"
- "sessions:redissession"
- "fullpagecache:redisfullpagecache"
- "solr:solr"
- "mysql:mysql"
- "mongodb:mongodb"
volumes:
- ./config/installer/php/php.ini:/usr/local/etc/php/php.ini
- ./config/installer/php/ext-xdebug.ini:/usr/local/etc/php/conf.d/ext-xdebug.ini
- ./htdocs:/var/www/htdocs
mongodb:
image: mongo:latest
environment:
- MONGO_DATA_DIR=/data/db
- MONGO_LOG_DIR=/dev/null
volumes:
- ./data/mongo:/data/db
ports:
- 27017:27017
command: mongod --smallfiles --logpath=/dev/null
Actually andreaskoch/dockerized-magento-installer has php5.6. But again - phpinfo shows PHP Version 7.0.28 and Server API FPM/FastCGI and it looks to
avestique/php7_fpm image.
Why MongoClient is not shown then?
So I have a trouble with mount new format version 2 docker compose file.
I have the code in folder wordpress inside where is location docker-compose file also I have inside the folder code docker file like this:
FROM debian:jessie
VOLUME /var/www/wordpress
When I used old format like this:
application:
build: code
volumes:
- ./wordpress:/var/www/wordpress
- ./logs/wordpress:/var/www/wordpress/app/logs
tty: true
db:
image: mysql
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: somename
MYSQL_USER: root
MYSQL_PASSWORD: root
php:
build: php-fpm
ports:
- 9001:9001
volumes_from:
- application
links:
- db
nginx:
build: nginx
ports:
- 8080:80
links:
- php
volumes_from:
- application
volumes:
- ./logs/nginx/:/var/log/nginx
elk:
image: willdurand/elk
ports:
- 81:80
volumes:
- ./elk/logstash:/etc/logstash
- ./elk/logstash/patterns:/opt/logstash/patterns
volumes_from:
- application
- php
- nginx
When I started use version '2' the same as code as previous version I got any error so I reformat my compose file and move dockerfile from code folder to insider main folder where is location docker-compose file. My new version docker-compose became looks like as:
version: '2'
services:
web:
build: .
volumes:
- /wordpress:/var/www/wordpress
- /logs/wordpress:/var/www/wordpress/app/logs
tty: true
db:
image: mysql
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: somename
MYSQL_USER: root
MYSQL_PASSWORD: root
php:
build: php-fpm
ports:
- 9001:9001
volumes_from:
- web
links:
- db
nginx:
build: nginx
ports:
- 82:82
links:
- php
volumes_from:
- web
volumes:
- /logs/nginx/:/var/log/nginx
elk:
image: willdurand/elk
ports:
- 81:80
volumes:
- /elk/logstash:/etc/logstash
- /elk/logstash/patterns:/opt/logstash/patterns
volumes_from:
- web
- php
- nginx
Finally after reformat the code docker-compose was successfully build and up but when I open my php and nginx container inside both of them in /var/www/worpdress I have just empty folder app is not my wordpress project.
In which place I was mistake with settings mount project volume?
Thanks in advance.
The problem is with the way you are defining the local directories to be used for the volumes. In your previous version, you were using ./wordpress, while in the new one, you're using just /wordpress.
When referencing local directories for volume mappings, they always have to start with ./ - please try this:
version: '2'
services:
web:
build: .
volumes:
- ./wordpress:/var/www/wordpress
- ./logs/wordpress:/var/www/wordpress/app/logs
One more thing: I recommend to always enclose the volume mappings in double quotes to avoid issues with space characters, e.g.:
version: '2'
services:
web:
build: .
volumes:
- "./wordpress:/var/www/wordpress"
- "./logs/wordpress:/var/www/wordpress/app/logs"
I am a beginner with Docker. I followed a tutorial and add docker-compose.yml file.
The file looks like this -
version: '2'
services:
webserver:
build: ./docker/webserver
image: image_name
ports:
- "80:80"
- "443:443"
volumes:
- /Users/user_name/Sites/project_name:/var/www/html
links:
- db
db:
image: mysql:5.7
ports:
- "3306:3306"
volumes:
- ./db:/usr/local/mysql/bin/mysql
environment:
- MYSQL_ROOT_PASSWORD=
- MYSQL_DATABASE=DB_NAME
I am able to run the project on the web on localhost address but the connection to mysql is not ok.
When I run 'docker ps -a' on terminal ( I am using Mac)the Status of the mysql is - Exited (1) 16 seconds ago and the PORTS is empty.
Any idea/help?