2017-02-22 20:59:06 +01:00
<!DOCTYPE html>
< html class = "no-js" >
< head lang = "en-us" >
< meta charset = "utf-8" >
< meta name = "viewport" content = "width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1" >
< meta http-equiv = "X-UA-Compatible" content = "IE=10" / >
< title > Getting started - Laradock Docs< / title >
< meta name = "generator" content = "Hugo 0.18.1" / >
< meta name = "description" content = "Laradock documentations." >
2017-02-22 21:13:04 +01:00
< link rel = "canonical" href = "http://laradock.io/getting-started/" >
2017-02-22 20:59:06 +01:00
< meta name = "author" content = "Mahmoud Zalt" >
2017-02-22 21:13:04 +01:00
< meta property = "og:url" content = "http://laradock.io/getting-started/" >
2017-02-22 20:59:06 +01:00
< meta property = "og:title" content = "Laradock Docs" >
2017-02-22 21:13:04 +01:00
< meta property = "og:image" content = "http://laradock.io/images/logo.png" >
2017-02-22 20:59:06 +01:00
< meta name = "apple-mobile-web-app-title" content = "Laradock Docs" >
< meta name = "apple-mobile-web-app-capable" content = "yes" >
< meta name = "apple-mobile-web-app-status-bar-style" content = "black-translucent" >
2017-02-22 21:13:04 +01:00
< link rel = "shortcut icon" type = "image/x-icon" href = "http://laradock.io/images/favicon.ico" >
< link rel = "icon" type = "image/x-icon" href = "http://laradock.io/images/favicon.ico" >
2017-02-22 20:59:06 +01:00
< style >
@font-face {
font-family: 'Icon';
2017-02-22 21:13:04 +01:00
src: url('http://laradock.io/fonts/icon.eot');
src: url('http://laradock.io/fonts/icon.eot')
2017-02-22 20:59:06 +01:00
format('embedded-opentype'),
2017-02-22 21:13:04 +01:00
url('http://laradock.io/fonts/icon.woff')
2017-02-22 20:59:06 +01:00
format('woff'),
2017-02-22 21:13:04 +01:00
url('http://laradock.io/fonts/icon.ttf')
2017-02-22 20:59:06 +01:00
format('truetype'),
2017-02-22 21:13:04 +01:00
url('http://laradock.io/fonts/icon.svg')
2017-02-22 20:59:06 +01:00
format('svg');
font-weight: normal;
font-style: normal;
}
< / style >
2017-02-22 21:13:04 +01:00
< link rel = "stylesheet" href = "http://laradock.io/stylesheets/application.css" >
< link rel = "stylesheet" href = "http://laradock.io/stylesheets/temporary.css" >
< link rel = "stylesheet" href = "http://laradock.io/stylesheets/palettes.css" >
< link rel = "stylesheet" href = "http://laradock.io/stylesheets/highlight/highlight.css" >
2017-02-22 20:59:06 +01:00
< link rel = "stylesheet" href = "//fonts.googleapis.com/css?family=Ubuntu:400,700|Ubuntu+Mono" >
< style >
body, input {
font-family: 'Ubuntu', Helvetica, Arial, sans-serif;
}
pre, code {
font-family: 'Ubuntu Mono', 'Courier New', 'Courier', monospace;
}
< / style >
2017-02-22 21:13:04 +01:00
< script src = "http://laradock.io/javascripts/modernizr.js" > < / script >
2017-02-22 20:59:06 +01:00
< / head >
< body class = "palette-primary-red palette-accent-teal" >
< div class = "backdrop" >
< div class = "backdrop-paper" > < / div >
< / div >
< input class = "toggle" type = "checkbox" id = "toggle-drawer" >
< input class = "toggle" type = "checkbox" id = "toggle-search" >
< label class = "toggle-button overlay" for = "toggle-drawer" > < / label >
< header class = "header" >
< nav aria-label = "Header" >
< div class = "bar default" >
< div class = "button button-menu" role = "button" aria-label = "Menu" >
< label class = "toggle-button icon icon-menu" for = "toggle-drawer" >
< span > < / span >
< / label >
< / div >
< div class = "stretch" >
< div class = "title" >
Getting started
< / div >
< / div >
< div class = "button button-github" role = "button" aria-label = "GitHub" >
< a href = "https://github.com/laradock" title = "@laradock on GitHub" target = "_blank" class = "toggle-button icon icon-github" > < / a >
< / div >
< / div >
< div class = "bar search" >
< div class = "button button-close" role = "button" aria-label = "Close" >
< label class = "toggle-button icon icon-back" for = "toggle-search" > < / label >
< / div >
< div class = "stretch" >
< div class = "field" >
< input class = "query" type = "text" placeholder = "Search" autocapitalize = "off" autocorrect = "off" autocomplete = "off" spellcheck >
< / div >
< / div >
< div class = "button button-reset" role = "button" aria-label = "Search" >
< button class = "toggle-button icon icon-close" id = "reset-search" > < / button >
< / div >
< / div >
< / nav >
< / header >
< main class = "main" >
< div class = "drawer" >
< nav aria-label = "Navigation" >
< a href = "https://github.com/laradock/laradock" class = "project" >
< div class = "banner" >
< div class = "logo" >
2017-02-22 21:13:04 +01:00
< img src = "http://laradock.io/images/logo.png" >
2017-02-22 20:59:06 +01:00
< / div >
< div class = "name" >
2017-02-22 21:13:04 +01:00
< strong > Laradock Docs < / strong >
2017-02-22 20:59:06 +01:00
< br >
laradock/laradock
< / div >
< / div >
< / a >
< div class = "scrollable" >
< div class = "wrapper" >
< ul class = "repo" >
< li class = "repo-download" >
< a href = "https://github.com/laradock/laradock/archive/master.zip" target = "_blank" title = "Download" data-action = "download" >
< i class = "icon icon-download" > < / i > Download
< / a >
< / li >
< li class = "repo-stars" >
< a href = "https://github.com/laradock/laradock/stargazers" target = "_blank" title = "Stargazers" data-action = "star" >
< i class = "icon icon-star" > < / i > Stars
< span class = "count" > – < / span >
< / a >
< / li >
< / ul >
< hr >
< div class = "toc" >
< ul >
< li >
2017-02-22 21:13:04 +01:00
< a title = "Introduction" href = "http://laradock.io/" >
2017-02-22 20:59:06 +01:00
Introduction
< / a >
< / li >
< li >
2017-02-22 21:13:04 +01:00
< a class = "current" title = "Getting started" href = "http://laradock.io/getting-started/" >
2017-02-22 20:59:06 +01:00
Getting started
< / a >
< ul id = "scrollspy" >
< / ul >
< / li >
< li >
2017-02-22 21:13:04 +01:00
< a title = "Documentation" href = "http://laradock.io/documentation/" >
Documentation
< / a >
< / li >
< li >
< a title = "Related Projects" href = "http://laradock.io/related-projects/" >
Related Projects
< / a >
< / li >
< li >
< a title = "Help & Questions" href = "http://laradock.io/help/" >
Help & Questions
< / a >
< / li >
< li >
< a title = "Contributing" href = "http://laradock.io/contributing/" >
Contributing
< / a >
< / li >
< li >
< a title = "License" href = "http://laradock.io/license/" >
2017-02-22 20:59:06 +01:00
License
< / a >
< / li >
< / ul >
< hr >
< span class = "section" > The author< / span >
< ul >
< li >
< a href = "https://github.com/laradock" target = "_blank" title = "@laradock on GitHub" >
@laradock on GitHub
< / a >
< / li >
< / ul >
< / div >
< / div >
< / div >
< / nav >
< / div >
< article class = "article" >
< div class = "wrapper" >
< h1 > Getting started < / h1 >
< p > < a name = "Requirements" > < / a > < / p >
< h2 id = "requirements:d680e8a854a7cbad6d490c445cba2eba" > Requirements< / h2 >
< ul >
< li > < a href = "https://git-scm.com/downloads" > Git< / a > < / li >
< li > < a href = "https://www.docker.com/products/docker/" > Docker< / a > < code > > = 1.12< / code > < / li >
< / ul >
< p > < a name = "Installation" > < / a > < / p >
< h2 id = "installation:d680e8a854a7cbad6d490c445cba2eba" > Installation< / h2 >
< p > Choose the setup the best suits your needs.< / p >
< h4 id = "a-setup-for-single-project:d680e8a854a7cbad6d490c445cba2eba" > A) Setup for Single Project:< / h4 >
< p > < em > (In case you want a Docker environment for each project)< / em > < / p >
< h5 id = "a-1-setup-environment-in-existing-project:d680e8a854a7cbad6d490c445cba2eba" > A.1) Setup environment in existing Project:< / h5 >
< p > < em > (In case you already have a project, and you want to setup an environment to run it)< / em > < / p >
< p > 1 - Clone this repository on your project root directory:< / p >
< pre > < code class = "language-bash" > git submodule add https://github.com/Laradock/laradock.git
< / code > < / pre >
< p > < em > Note 1: If you are not yet using Git for your PHP project, you can use < code > git clone https://github.com/Laradock/laradock.git< / code > instead.< / em > < / p >
2017-02-22 21:13:04 +01:00
< p > < em > Note 2: To keep track of your LaraDock changes, between your projects and also keep LaraDock updated. < a href = "#keep-tracking-LaraDock" > Check this< / a > < / em > < / p >
2017-02-22 20:59:06 +01:00
< p > < em > Note 3: In this case the folder structure will be like this:< / em > < / p >
< pre > < code > - project1
- laradock
- project2
- laradock
< / code > < / pre >
< h5 id = "a-2-setup-environment-first-then-create-project:d680e8a854a7cbad6d490c445cba2eba" > A.2) Setup environment first then create project:< / h5 >
< p > < em > (In case you don't have a project, and you want to create your project inside the Docker environment)< / em > < / p >
< p > 1 - Clone this repository anywhere on your machine:< / p >
2017-02-22 21:13:04 +01:00
< pre > < code class = "language-bash" > git clone https://github.com/laradock/laradock.git
2017-02-22 20:59:06 +01:00
< / code > < / pre >
< p > Note: In this case the folder structure will be like this:< / p >
< pre > < code > - projects
- laradock
- myProject
< / code > < / pre >
< p > 2 - Edit the < code > docker-compose.yml< / code > file to map to your project directory once you have it (example: < code > - ../myProject:/var/www< / code > ).< / p >
< p > 3 - Stop and re-run your docker-compose command for the changes to take place.< / p >
< pre > < code > docker-compose stop & & docker-compose up -d XXXX YYYY ZZZZ ....
< / code > < / pre >
< h4 id = "b-setup-for-multiple-projects:d680e8a854a7cbad6d490c445cba2eba" > B) Setup for Multiple Projects:< / h4 >
< p > 1 - Clone this repository anywhere on your machine:< / p >
2017-02-22 21:13:04 +01:00
< pre > < code class = "language-bash" > git clone https://github.com/laradock/laradock.git
2017-02-22 20:59:06 +01:00
< / code > < / pre >
< p > 2 - Edit the < code > docker-compose.yml< / code > file to map to your projects directories:< / p >
< pre > < code > applications:
image: tianon/true
volumes:
- ../project1/:/var/www/project1
- ../project2/:/var/www/project2
< / code > < / pre >
2017-02-22 21:13:04 +01:00
< p > 3 - You can access all sites by visiting < code > http://localhost/project1/public< / code > and < code > http://localhost/project2/public< / code > but of course that's not very useful so let's setup NGINX quickly.< / p >
2017-02-22 20:59:06 +01:00
< p > 4 - Go to < code > nginx/sites< / code > and copy < code > sample.conf.example< / code > to < code > project1.conf< / code > then to < code > project2.conf< / code > < / p >
< p > 5 - Open the < code > project1.conf< / code > file and edit the < code > server_name< / code > and the < code > root< / code > as follow:< / p >
< pre > < code > server_name project1.dev;
root /var/www/project1/public;
< / code > < / pre >
< p > Do the same for each project < code > project2.conf< / code > , < code > project3.conf< / code > ,...< / p >
< p > 6 - Add the domains to the < strong > hosts< / strong > files.< / p >
< pre > < code > 127.0.0.1 project1.dev
< / code > < / pre >
< p > 7 - Create your project Databases. Right now you have to do it manually by entering your DB container, until we automate it soon.< / p >
< p > < a name = "Usage" > < / a > < / p >
< h2 id = "usage:d680e8a854a7cbad6d490c445cba2eba" > Usage< / h2 >
< p > < strong > Read Before starting:< / strong > < / p >
< p > If you are using < strong > Docker Toolbox< / strong > (VM), do one of the following:< / p >
< ul >
2017-02-22 21:13:04 +01:00
< li > Upgrade to Docker < a href = "https://www.docker.com/products/docker" > Native< / a > for Mac/Windows (Recommended). Check out < a href = "#upgrading-laradock" > Upgrading LaraDock< / a > < / li >
< li > Use LaraDock v3.* (Visit the < code > LaraDock-ToolBox< / code > < a href = "https://github.com/laradock/laradock/tree/LaraDock-ToolBox" > Branch< / a > ).< / li >
2017-02-22 20:59:06 +01:00
< / ul >
< p > < br > < / p >
< blockquote >
< p > < strong > Warning:< / strong > If you used an older version of LaraDock it's highly recommended to rebuild the containers you need to use < a href = "#Build-Re-build-Containers" > see how you rebuild a container< / a > in order to prevent errors as much as possible.< / p >
< / blockquote >
< p > < br > < / p >
< p > 1 - Run Containers: < em > (Make sure you are in the < code > laradock< / code > folder before running the < code > docker-compose< / code > commands).< / em > < / p >
< p > < strong > Example:< / strong > Running NGINX and MySQL:< / p >
< pre > < code class = "language-bash" > docker-compose up -d nginx mysql
< / code > < / pre >
< p > < strong > Note< / strong > : The < code > workspace< / code > and < code > php-fpm< / code > will run automatically in most of the cases, so no need to specify them in the < code > up< / code > command. If you couldn't find them running then you need specify them as follow: < code > docker-compose up -d nginx php-fpm mysql workspace< / code > .< / p >
< p > You can select your own combination of Containers form the list below:< / p >
< p > < code > nginx< / code > , < code > hhvm< / code > , < code > php-fpm< / code > , < code > mysql< / code > , < code > redis< / code > , < code > postgres< / code > , < code > mariadb< / code > , < code > neo4j< / code > , < code > mongo< / code > , < code > apache2< / code > , < code > caddy< / code > , < code > memcached< / code > , < code > beanstalkd< / code > , < code > beanstalkd-console< / code > , < code > rabbitmq< / code > , < code > workspace< / code > , < code > phpmyadmin< / code > , < code > aerospike< / code > , < code > pgadmin< / code > , < code > elasticsearch< / code > , < code > rethinkdb< / code > .< / p >
< p > < br >
2 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, ...).< / p >
< pre > < code class = "language-bash" > docker-compose exec workspace bash
< / code > < / pre >
2017-02-22 21:13:04 +01:00
< p > Alternatively, for Windows PowerShell users: execute the following command to enter any running container:< / p >
2017-02-22 20:59:06 +01:00
< pre > < code class = "language-bash" > docker exec -it {workspace-container-id} bash
< / code > < / pre >
< p > < strong > Note:< / strong > You can add < code > --user=laradock< / code > (example < code > docker-compose exec --user=laradock workspace bash< / code > ) to have files created as your host's user. (you can change the PUID (User id) and PGID (group id) variables from the < code > docker-compose.yml< / code > ).< / p >
< p > < br >
3 - Edit your project configurations.< / p >
< p > Open your < code > .env< / code > file and set the < code > DB_HOST< / code > to < code > mysql< / code > :< / p >
< pre > < code class = "language-env" > DB_HOST=mysql
< / code > < / pre >
< p > < em > If you want to use Laravel and you don't have it installed yet, see < a href = "#Install-Laravel" > How to Install Laravel in a Docker Container< / a > .< / em > < / p >
< p > < br >
4 - Open your browser and visit your localhost address (< code > http://localhost/< / code > ).< / p >
< p > < br >
< strong > Debugging< / strong > : if you are facing any problem here check the < a href = "#debugging" > Debugging< / a > section.< / p >
< p > If you need a special support. Contact me, more details in the < a href = "#Help" > Help & Questions< / a > section.< / p >
< aside class = "copyright" role = "note" >
Documentation built with
< a href = "https://www.gohugo.io" target = "_blank" > Hugo< / a >
using the
< a href = "http://github.com/digitalcraftsman/hugo-material-docs" target = "_blank" > Material< / a > theme.
< / aside >
< footer class = "footer" >
< nav class = "pagination" aria-label = "Footer" >
< div class = "previous" >
< / div >
< div class = "next" >
2017-02-22 21:13:04 +01:00
< a href = "http://laradock.io/documentation/" title = "Documentation" >
2017-02-22 20:59:06 +01:00
< span class = "direction" >
Next
< / span >
< div class = "page" >
< div class = "stretch" >
< div class = "title" >
2017-02-22 21:13:04 +01:00
Documentation
2017-02-22 20:59:06 +01:00
< / div >
< / div >
< div class = "button button-next" role = "button" aria-label = "Next" >
< i class = "icon icon-forward" > < / i >
< / div >
< / div >
< / a >
< / div >
< / nav >
< / footer >
< / div >
< / article >
< div class = "results" role = "status" aria-live = "polite" >
< div class = "scrollable" >
< div class = "wrapper" >
< div class = "meta" > < / div >
< div class = "list" > < / div >
< / div >
< / div >
< / div >
< / main >
< script >
2017-02-22 21:13:04 +01:00
var base_url = 'http:\/\/laradock.io\/';
2017-02-22 20:59:06 +01:00
var repo_id = 'laradock\/laradock';
< / script >
2017-02-22 21:13:04 +01:00
< script src = "http://laradock.io/javascripts/application.js" > < / script >
2017-02-22 20:59:06 +01:00
< script >
/* Add headers to scrollspy */
var headers = document.getElementsByTagName("h2");
var scrollspy = document.getElementById('scrollspy');
if(scrollspy) {
if(headers.length > 0) {
for(var i = 0; i < headers.length ; i + + ) {
var li = document.createElement("li");
li.setAttribute("class", "anchor");
var a = document.createElement("a");
a.setAttribute("href", "#" + headers[i].id);
a.setAttribute("title", headers[i].innerHTML);
a.innerHTML = headers[i].innerHTML;
li.appendChild(a)
scrollspy.appendChild(li);
}
} else {
scrollspy.parentElement.removeChild(scrollspy)
}
/* Add permanent link next to the headers */
var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");
for(var i = 0; i < headers.length ; i + + ) {
var a = document.createElement("a");
a.setAttribute("class", "headerlink");
a.setAttribute("href", "#" + headers[i].id);
a.setAttribute("title", "Permanent link")
a.innerHTML = "#";
headers[i].appendChild(a);
}
}
< / script >
< script src = "//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js" > < / script >
< script > hljs . initHighlightingOnLoad ( ) ; < / script >
< / body >
< / html >