by Devin Yang
(This article was automatically translated.)

Published - 6 years ago ( Updated - 6 years ago )

Chowner about D-Laravel

This article explains the function of chowner in D-Laravel.
If you are a Linux user, you may need to do this.

Why Chowner

Let's understand this first. Although it is a container, the uid used by Docker's container in the Linux system will be the same as the uid used by your host side (share the same Kernel).
When the uid on your host is 500, start the D-Laravel container, and the dlaravel (default 1000) in the fpm Container does not have the right to write files to your directory.
So, Laravel's webpage will spray you with a bunch of errors, because dlaravel in fpm cannot write files to the storage directory.

There are three solutions

1. In the simplest way, we directly create a user whose uid and gid are 1000 in the Linux system on the Host side to execute D-Laravel.
2. Through chowner, we change the userid of the container in D-Laravel's FPM to the uid we use, for example: 500.
3. Rebuild an FPM image by yourself, and set the uid as the user on your own host.

D-Laravel chowner operation process

(OSX users do not need to do this, because OSX uses Hyperkit to run in the virtual environment)
1. ./console up 
start container

2. ./console chowner
Adjust the uid inside the container to be the same as your uid.

3. docker ps|grep deviny/fpm
To find out the fpm used by dlaravel, we need to commit the changed container to a new image.


4. docker commit 04496a60f0e7 myfpm724
The image name above can be taken by yourself, or we can directly overwrite the used image.
docker commit 04496a60f0e7 deviny/fpm:7.2.4
You need to adjust the image name used by the php service in docker-compose.yml, if you have taken a new name yourself.

5. Execute in the directory of D-Laravel, cd etc/php-fpm.d
Enter the fpm configuration file directory.

6. cp www.conf.sample www.conf 
Copy the sample file as www.conf, and modify the uid inside to be the same user as you
content_copyuser = 500
group = 500
How to know the uid and gid executed by yourself, you can enter id in the terminal to get it.

7. ./console restart
restart container

8. ./console
Enter the fpm container.

9. id
After confirming the restart, in the container, use the new uid we set, not 1000.
 

Tags: dlaravel

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


nginx,dlaravel

How to configure HTTPS on nginx to get an SSL A+ score from Qualys

This article describes how to adjust the ssl settings of nginx so that the website can obtain an SSL report and get an A+ rating. Here I am using letsencrypt free credentials. As long as you use the official Docker nginx new version image preset by D-Laravel, you should be able to achieve the same effect as mine. You can check your host SSL settings through the following. https://www.ssllabs.com/ssltest/index.html

dlaravel

How to directly execute the php artisan of different projects in the container on the host.

This article is the application teaching of D-Laravel, how to directly execute php artisan in the container on the host side. After customizing the alias, you can directly execute php artisan in the contianer in the project folder on the host side. alias a="../../artisan.sh"

dlaravel

D-Laravel test domain name *.dev changed to *.test

Since Google Chrome 63 will forcibly convert the domain name of *.dev to https, the domain name of the new version of D-Laravel will be changed to *.test. This article explains how to update.

In order to provide you with better services, this website uses cookies. By continuing to browse the web, you agree to our cookies policy. To understanding