From fa7d3c239cf646612991c76f64de7f40f95a8a1c Mon Sep 17 00:00:00 2001 From: Lan Phan Date: Tue, 27 Nov 2018 15:57:36 +0700 Subject: [PATCH] Fix Permission denied (#1893) * Revert "default user for workspace is laradock, so that owner of log file when running php artisan command doesn't change (#1875)" This reverts commit 156d124db01b28dd425c28bbadb4d523b6e887bb. * update document to inform user should add --user=laradock when exec into workspace, update sync.sh bash to exec into workspace with user laradock --- DOCUMENTATION/content/documentation/index.md | 2 +- sync.sh | 4 ++-- workspace/Dockerfile | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DOCUMENTATION/content/documentation/index.md b/DOCUMENTATION/content/documentation/index.md index 80e787cb..38337d8b 100644 --- a/DOCUMENTATION/content/documentation/index.md +++ b/DOCUMENTATION/content/documentation/index.md @@ -508,7 +508,7 @@ docker-compose ps docker-compose exec workspace bash ``` -Add `--user=laradock` (example `docker-compose exec --user=laradock workspace bash`) to have files created as your host's user. +Note: Should add `--user=laradock` (example `docker-compose exec --user=laradock workspace bash`) to have files created as your host's user to prevent issue owner of log file will be changed to root then laravel website cannot write on log file if using rotated log and new log file not existed 4 - Run anything you want :) diff --git a/sync.sh b/sync.sh index 237d55a7..95f415ff 100755 --- a/sync.sh +++ b/sync.sh @@ -41,7 +41,7 @@ display_options () { print_style " install" "info"; printf "\t\t Installs docker-sync gem on the host machine.\n" print_style " up [services]" "success"; printf "\t Starts docker-sync and runs docker compose.\n" print_style " down" "success"; printf "\t\t\t Stops containers and docker-sync.\n" - print_style " bash" "success"; printf "\t\t\t Opens bash on the workspace.\n" + print_style " bash" "success"; printf "\t\t\t Opens bash on the workspace with user laradock.\n" print_style " sync" "info"; printf "\t\t\t Manually triggers the synchronization of files.\n" print_style " clean" "danger"; printf "\t\t Removes all files from docker-sync.\n" } @@ -69,7 +69,7 @@ elif [ "$1" == "down" ]; then docker-sync stop elif [ "$1" == "bash" ]; then - docker-compose exec workspace bash + docker-compose exec --user=laradock workspace bash elif [ "$1" == "install" ]; then print_style "Installing docker-sync\n" "info" diff --git a/workspace/Dockerfile b/workspace/Dockerfile index c82a48a2..04d38118 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -889,12 +889,12 @@ RUN php -v | head -n 1 | grep -q "PHP ${LARADOCK_PHP_VERSION}." #-------------------------------------------------------------------------- # +USER root + # Clean up RUN apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ rm /var/log/lastlog /var/log/faillog -USER laradock - # Set default work directory WORKDIR /var/www