Skip to content

Commit fa7d3c2

Browse files
lanphanbestlong
authored andcommitted
Fix Permission denied (laradock#1893)
* Revert "default user for workspace is laradock, so that owner of log file when running php artisan command doesn't change (laradock#1875)" This reverts commit 156d124. * update document to inform user should add --user=laradock when exec into workspace, update sync.sh bash to exec into workspace with user laradock
1 parent 2203297 commit fa7d3c2

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

DOCUMENTATION/content/documentation/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ docker-compose ps
508508
docker-compose exec workspace bash
509509
```
510510

511-
Add `--user=laradock` (example `docker-compose exec --user=laradock workspace bash`) to have files created as your host's user.
511+
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
512512

513513

514514
4 - Run anything you want :)

sync.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ display_options () {
4141
print_style " install" "info"; printf "\t\t Installs docker-sync gem on the host machine.\n"
4242
print_style " up [services]" "success"; printf "\t Starts docker-sync and runs docker compose.\n"
4343
print_style " down" "success"; printf "\t\t\t Stops containers and docker-sync.\n"
44-
print_style " bash" "success"; printf "\t\t\t Opens bash on the workspace.\n"
44+
print_style " bash" "success"; printf "\t\t\t Opens bash on the workspace with user laradock.\n"
4545
print_style " sync" "info"; printf "\t\t\t Manually triggers the synchronization of files.\n"
4646
print_style " clean" "danger"; printf "\t\t Removes all files from docker-sync.\n"
4747
}
@@ -69,7 +69,7 @@ elif [ "$1" == "down" ]; then
6969
docker-sync stop
7070

7171
elif [ "$1" == "bash" ]; then
72-
docker-compose exec workspace bash
72+
docker-compose exec --user=laradock workspace bash
7373

7474
elif [ "$1" == "install" ]; then
7575
print_style "Installing docker-sync\n" "info"

workspace/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,12 +889,12 @@ RUN php -v | head -n 1 | grep -q "PHP ${LARADOCK_PHP_VERSION}."
889889
#--------------------------------------------------------------------------
890890
#
891891

892+
USER root
893+
892894
# Clean up
893895
RUN apt-get clean && \
894896
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
895897
rm /var/log/lastlog /var/log/faillog
896898

897-
USER laradock
898-
899899
# Set default work directory
900900
WORKDIR /var/www

0 commit comments

Comments
 (0)