Running Artisan Commands. - stevexuereb/laravel-docker GitHub Wiki

When you have docker all of your docker images running by using $ sudo docker-compose up, inside of the root directory of your Laravel installation.

If you $ sudo docker ps you will see all of the current containers that you have running, by theory you should have 5 containers running like the following.

CONTAINER ID        IMAGE                       COMMAND                  CREATED             STATUS              PORTS                    NAMES
1143d6f1436a        steveazz/laravel-commands   "/sbin/my_init"          22 hours ago        Up 8 minutes                                 laravel_laravel-commands_1
5ed2bc678141        steveazz/nginx              "/sbin/my_init"          22 hours ago        Up 8 minutes        127.0.0.1:8080->80/tcp   laravel_web_1
30936abeba1d        nmcteam/php56               "/sbin/my_init"          22 hours ago        Up 8 minutes        9000/tcp                 laravel_php_1
8cdeb242c852        sameersbn/mysql             "/sbin/entrypoint.sh "   22 hours ago        Up 8 minutes        3306/tcp                 laravel_db_1
742ab3d8e3e1        steveazz/gulp               "/sbin/my_init"          22 hours ago        Up 8 minutes                                 laravel_gulp_1
                                                                                                                                                             

You will have to ssh into the laravel-commands to do this you have to run the following command sudo docker exec -it CONTAINERID /bin/bash, in our case we have to run the following :

$ sudo docker exec -it 1143d6f1436a /bin/bash

What will this command do is ssh inside of you container in the root directory.

Change the current working directory to /var/www where your Laravel installation is located at by default and if you run php artisan you will see the list of all of the commands that are aviable.

$ cd /var/www
$ php artisan
'List of artisan commands...'

Now you can run all of the commands Laravel such as php artisan make:controller