Skip to content

Instantly share code, notes, and snippets.

@manashcse11
Last active November 7, 2020 16:11
Show Gist options
  • Save manashcse11/2549b9ceebf385923c9a0c030b473d22 to your computer and use it in GitHub Desktop.
Save manashcse11/2549b9ceebf385923c9a0c030b473d22 to your computer and use it in GitHub Desktop.
Local docker setup for Laravel

Follow: https://www.digitalocean.com/community/tutorials/how-to-containerize-a-laravel-application-for-development-with-docker-compose-on-ubuntu-18-04

To connect database with workbench create ports section (sample docker-compose.yml file: https://gist.github.com/manashcse11/75c97f5f5b4822e2925efa08a005fb67)

Stackoverflow: https://stackoverflow.com/a/51437525/1197239

Apply changes after any change in docker-compose.yml file

sudo docker-compose up -d

stop all containers:

sudo docker kill $(sudo docker ps -q)

remove all containers

sudo docker rm $(sudo docker ps -a -q)

remove all docker images

sudo docker rmi $(sudo docker images -q)

Prune after removing all

sudo docker volume prune

Any problem, restart docker:

sudo service docker restart

Run artisan command, inside project directory

sudo docker-compose exec app php artisan

Change ownership to require any package through composer

sudo chown -R manash:www-data api/vendor/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment