-
-
Save anonymous/a13cf604981726c8e8b0bb05a35664e2 to your computer and use it in GitHub Desktop.
FROM php:7.0.4-fpm | |
RUN apt-get update && apt-get install -y libmcrypt-dev \ | |
mysql-client libmagickwand-dev --no-install-recommends \ | |
&& pecl install imagick \ | |
&& docker-php-ext-enable imagick \ | |
&& docker-php-ext-install mcrypt pdo_mysql |
version: '2' | |
services: | |
# The Application | |
app: | |
build: | |
context: ./ | |
dockerfile: app.dockerfile | |
working_dir: /var/www | |
volumes: | |
- ./:/var/www | |
environment: | |
- "DB_PORT=3306" | |
- "DB_HOST=database" | |
# The Web Server | |
web: | |
build: | |
context: ./ | |
dockerfile: web.dockerfile | |
working_dir: /var/www | |
volumes_from: | |
- app | |
ports: | |
- 8080:80 | |
# The Database | |
database: | |
image: mysql:5.6 | |
volumes: | |
- dbdata:/var/lib/mysql | |
environment: | |
- "MYSQL_ROOT_PASSWORD=secret" | |
- "MYSQL_DATABASE=homestead" | |
- "MYSQL_USER=homestead" | |
ports: | |
- "33061:3306" | |
volumes: | |
dbdata: |
server { | |
listen 80; | |
index index.php index.html; | |
root /var/www/public; | |
location / { | |
try_files $uri /index.php?$args; | |
} | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass app:9000; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
} | |
} |
FROM nginx:1.10 | |
ADD vhost.conf /etc/nginx/conf.d/default.conf |
Hello,
I followed the medium article and I've applied a small fix on line 11 of docker-compose.yml
, changing the path on the local machine to use the renamed laravel's folder as my-site
folder. I think that it allow isolating the project (laravel) files into a specific folder when the environment setup files still on the root folder.
volumes:
- ./my-site:/var/www
I have followed this tutorial and all is working... However, I am trying to connect to MySQL database using Sequel Pro (on Mac) and can't seem to get a connection. DO you happen to know what it would take to get Sequel Pro working?
Not working for me... I'm on mac os x 10.13.3, with Docker CE 17.12.0-ce-mac49.
At the moment, with this exact configuration, it says me
nginx: [emerg] invalid number of arguments in "fastcgi_pass" directive in /etc/nginx/conf.d/default.conf:12
on containers with this exact configuration.
Someone could help me?
@mfour-merickson I was able to connect with mysqlworkbench
I first ran the below and looked at the network settings
docker inspect <container id>
For my bindings within the "network settings" were set to below
"3306/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "33061"
}
]
Now back in mysqlworkbench using the below
host : 0.0.0.0
port: 33061
username: root
password: secret
Now this worked for root, was unable to connect as the homestead user
Hi guys I got this error.
ERROR: In file './docker-compose.yml', volume must be a mapping, not a NoneType.
Change to php:7.1-fpm to support laravel 5.6 - php:7.2-fpm has too many issues and wont compile.
@adibnoh make sure the indentation is correct in docker-compose.yml (ex: dbdata should be indented in volumes)
Hello, I followed the post from medium. Everything works fine. But after i write the following commands the development server do not starts at 0.0.0.0:8080 or 127.0.0.1:8000
docker-compose exec app php artisan key:generate
docker-compose exec app php artisan optimize
Hello, I followed the post from medium. Everything works fine. But after i write the following commands the development server do not starts at 0.0.0.0:8080 or 127.0.0.1:8000
docker-compose exec app php artisan key:generate
docker-compose exec app php artisan optimize
Is there any error message on screen. can you share screenshot?
Hello, everything runs smoothly BUT all assets on the Laravel installation return a 404 error, any ideas?
Hi!
even after
docker-compose exec app php artisan key:generate
docker-compose exec app php artisan optimize
I got 500 error and don't start from
http://127.0.0.1:8080/
http://0.0.0.0:8080/
http://localhost:8080/and after
docker-compose exec app php artisan migrate --seed
I got error
[Illuminate\Database\QueryException]
SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'111.11.11.11' (using password: YES) (SQL: select * from information_schema.table
s where table_schema = homestead and table_name = migrations)[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'111.11.11.11' (using password: YES)but in .env
and
docker-compose.yml
they mathesmy docker-compose.yml
Begin of docker-compose.yml
version: '2'
services:The Application
app:
build:
context: ./
dockerfile: app.dockerfile
working_dir: /var/www
volumes:
- ./:/var/www
environment:- "DB_PORT=3306"
- "DB_HOST=database"
The Web Server
web:
build:
context: ./
dockerfile: web.dockerfile
working_dir: /var/www
volumes_from:
- app
ports:8080:80
The Database
database:
image: mysql:5.6
volumes:
- dbdata:/var/lib/mysql
environment:- "MYSQL_ROOT_PASSWORD=secret"
- "MYSQL_DATABASE=homestead"
- "MYSQL_USER=homestead"
ports:- "33061:3306"
volumes:
dbdata:END OF docker-compose.yml
my .env file
Begin .env file
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhostDB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secretBROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=syncREDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=nullPUSHER_APP_ID=
PUSHER_KEY=
PUSHER_SECRET=
I found error after just posted my issue :)
do this
sudo chmod -R 777 storage && sudo chmod -R 777 bootstrap/cache
and m.b. regenerate keys
docker-compose exec app php artisan key:generate
docker-compose exec app php artisan optimize
in my case it works.
Hello, everything runs smoothly BUT all assets on the Laravel installation return a 404 error, any ideas?
check where you /app placed
app:
build:
context: ./
dockerfile: app.dockerfile
working_dir: /var/www
volumes:
- ./:/var/www
environment:
- "DB_PORT=3306"
- "DB_HOST=database"
in my case from root of app and my folder named e.g. myapp there located all project
I recommended check vhost.conf and docker-compose.yml.
Also, you could compare you files with
https://github.com/shakyShane/laravel-docker
file: docker-compose.yml
database->environment is missing variable - "MYSQL_ROOT_PASSWORD=secret"