Create a homestead docker container for your development env.
(Adapted from laravel homestead provisionning script)
Install docker && docker compose
please refer to these tutorials:
- install docker (https://docs.docker.com/installation/ubuntulinux/)
curl -sSL https://get.docker.com/ | sh
- install docker compose (https://docs.docker.com/compose/install/)
curl -L https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
Pull homestead image
docker pull shincoder/homestead:php7.1
Clone && Edit docker-compose.yml
git clone https://github.com/shincoder/homestead-docker.git
docker-compose.yml then edit the file with you own
paths and ports.
Start your containers
There are only two containers to run. web container ( includes everything except your database ),
and mariadb container.
sudo docker-compose up -d
SSH into the container (password: secret):
ssh -p 2222 homestead@localhost
Add a virtual host
Assuming you mapped your apps folder to
/apps (you can change mappings in the docker-compose.yml file,
it's prefered to use absolute paths), you can do:
cd / && ./serve.sh myapp.dev /apps/myapp/public
In the host, update
/etc/hosts to include your app domain:
Our web container starts nginx, php-fpm, redis, beanstalk. and has npm, gulp, bower...etc
- Since the web and database containers are linked you can use
mysqlas the host in your
.envfile with an empty password to properly connect to your database.
DB_HOST=mysql DB_PORT=3306 DB_USERNAME=root DB_PASSWORD=