by Devin Yang
(This article was automatically translated.)

Published - 7 years ago ( Updated - 7 years ago )

Usage scenarios

In the world of Docker , we create images through Dockerfile, and generate new images through docker commit,
Then push the image to the Docker registry. (eg: Docker Hub).
We will define the service and the image to be used in the yaml file of docker-compose,
So when we execute docker-compose up ,
docker will check whether the image set in docker-compose.yml already exists in our system,
If not, download it, and then use the image as a template (image is a read-only template) to create a container.
 

D-Laravel

In the essence of dlaravel , it is docker , but with the addition of simple bash , we can quickly use docker commands to generate contaner .
You may wonder why bash is used, because I want everyone to check and understand how D-Laravel is executed (if you want to know).

Having said that, that is to say, when we issue the ./console up command, he is executing docker's official command docker-compose up -d
Therefore, if we have already downloaded a certain image, such as deviny/fpm:7.2.17, the next time we start docker-compose, we will not download the image to create a container.
Then how do we update the adjusted image to our computer through instructions?
We can use the command docker pull deviny/fpm:7.2.17 to update.

Regarding the image of D-Laravel, you should try to use the latest version of PHP,
Mainly there will be PHP's own security and bug fixes, including some updates and adjustments to the D-Laravel operating environment.

Although D-Laravel's image provides many tags with different PHP version numbers...
https://hub.docker.com/r/deviny/fpm/tags/

E.g:
PHP 7.1.7 and PHP 7.1.28 are recommended to choose 7.1.28
or
php 5.6.30 and php 5.6.31 are recommended to choose 5.6.31

We should use the newer version in our own docker-compose-custom.yml settings.
If there is no docker-compose-custom.yml in your D-Laravel folder, you can generate and use it through ./console custom.

If you find that some php extensions in images in D-Laravel cannot be used, for example, PHP can be executed on other platforms,
But it cannot be implemented on D-Laravel. Welcome to open a PR to me, or leave a message in the exclusive chat room of D-Laravel . I will add this extension according to the situation.

So how to update the image we are already using (image with the same tag name)?
For example, take the image of deviny/fpm:7.1.8 as an example, you can try to see, git pull deviny/fpm:7.1.8
$docker pull deviny/fpm:7.1.8
7.1.8: Pulling from deviny/fpm
Digest: sha256:3b3f9c98bd143c1487c70fa9b072dd95915aaec84b1ab8b1de61940dd015bf55
Status: Image is up to date for deviny/fpm:7.1.8
Basically, the same version number of D-Laravel's image changes very rarely.
You don't need to do this unless you really encounter some problems in use, such as some extensions can't be used.
If there is a newer tag, you can use the newer tag directly, for example: deviny/fpm:7.1.9

In the new version of D-Laravel, we can use ./console ext to view the currently installed and compiled php plug-ins.

Rebuild your own proprietary image

Of course, you can definitely rebuild the php-fpm image used by your own D-Laravel to meet your own environment needs .
Proceed as follows:
#在D-Laravel的目錄執行
cd dockerfiles/fpm/7.3
#Check if there is a Docekrfile in the directory
ls
#Modify with an editor, add more php extensions to Dockerfile
# Then use the command below to build your own image.
docker build -t myphp .
After completion, remember to modify the image of the php service in your docker-compose.yml to your image name, here is myphp as an example.
Finally, restart the container to see if it works.
 ./console restart

If you have any questions about D-Laravel or the problem of rebuilding images, please leave a message in the following chat room to discuss.
D-Laravel chat room

Tags: docker

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


php,docker,dlaravel

A brief introduction to the phpenv container environment I built

I don't have time to shoot an introduction video, so I'll just grab some pictures and introduce the container environment deviny/phpenv I use. https://github.com/DevinY/phpenvphpenv can be regarded as an evolutionary version of my previous D-Laravel open source project, conceptually extending the use of many Dlaravel operation methods. The update of the container tends to be controlled by the user to build his own image, so I am not very good at changing the version number. In fact, the php version number of D-Laravel seems to have not been changed for a long time:p

docker

The use of iptabels is required in the Docker Swarm environment

First of all, in the Linux environment, Docker uses iptables rules to provide network isolation. However, in the environment of Docker swarm mode, we cannot identify the connection port under 127.0.0.1 of the host. At this time, we can customize the rules through the DOCKER-USER chain in iptables.

docker, tinkerwell, tinker, laravel

Application of Tinkerwell and docker environment

In fact, I don't use Tinkerwell recently because it keeps costing me money to update. If you want to test the direct ssh host, it’s done, isn’t it?