by Devin Yang
(This article was automatically translated.)

Published - 6 years ago ( Updated - 6 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


docker, goaccess, config

phpenv actual combat GoAccess is real website analysis (docker version)

Before I start, let me say that GoAccess can also generate static data as long as you have a log, because I think the real-time feeling is more dazzling, so this article will focus on the part of GoAccess real-time display. Although Google Analytics (GA) is very useful, it is also very good to try another GA. For example, you want to know which browsers website users use to visit the website.

docker,polymer,seo

Solving Polymer SEO Problems with Rendertron (Polymer Summit 2017)

The video below the article introduces how to use rendertron to solve Polymer SEO optimization problems. In the source of my fork, it has been adjusted to support the Chinese environment. And also added the API interface of pdf, which can also be used to convert pdf.

docker,sqlserver

D-Laravel builds SQL Server environment

How to build D-Laravel's SQL Server environment