02 Local development environment with Docker and Docker Compose



In this video, we are going to set up a development environment for our Laravel application using Docker Compose.

Relevant links:

– Laravel documentation: https://laravel.com/docs/7.x/deployment#nginx
– Docker Compose installation guide: https://docs.docker.com/compose/install/
– Erika’s awesome tutorial on Containerizing a Laravel application: https://www.digitalocean.com/community/tutorials/how-to-containerize-a-laravel-application-for-development-with-docker-compose-on-ubuntu-18-04
– Official PHP Docker Image: https://hub.docker.com/_/php
– Official Nginx Docker Image: https://hub.docker.com/_/nginx
– Official MySQL Docker Image: https://hub.docker.com/_/mysql
– Official Node Docker Image: https://hub.docker.com/_/node
– Official Redis Docker Image: https://hub.docker.com/_/redis

source

9 thoughts on “02 Local development environment with Docker and Docker Compose”
  1. Hello Tony, That was a good and clear tutorial on running laravel on docker in ubuntu. Thank you. As a side note, can i ask you please to tell me what configurations you use on bash terminal profile that show seconds that a command took, docker version and …?

  2. Is there any particular reason for setting the working_dir to /var/www/html ? Excellent videos series, bravo

  3. hello, bro
    the database is not auto-create for me, what should I do?
    I got error when run artisan migrate
    —– error —-

    ➜ docker-compose ps
    Name Command State Ports
    ————————————————————————————————–
    dockerforlaravel-app-master_db_1 docker-entrypoint.sh mysqld Up 3306/tcp, 33060/tcp
    dockerforlaravel-app-master_node_1 docker-entrypoint.sh npm r … Up
    dockerforlaravel-app-master_php_1 docker-php-entrypoint php-fpm Up 9000/tcp
    dockerforlaravel-app-master_redis_1 docker-entrypoint.sh redis … Up 6379/tcp
    dockerforlaravel-app-master_web_1 nginx -g daemon off; Up 0.0.0.0:80->80/tcp
    ➜ docker-compose exec php php artisan migrate

    IlluminateDatabaseQueryException

    SQLSTATE[HY000] [1049] Unknown database 'laravel' (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')

    —– end error ——-

    when I enter the db container and show databases, it not in the list.
    I went to documentation of mysql docker hub, it said environment MYSQL_DATABASE will auto create.
    I also restart whole containers but not help.

    could you advise what should I do next?

  4. Nice video and very clear and good one. I would like to suggest an add-on video where you install an ssh service inside the php container. It has some good use cases like using Tinkerwell on a contained app.

    Thank you so much for these videos.

Leave a Reply

Your email address will not be published.

Captcha loading...