DOCKER:PHP7 Mirroring Construction Issues

Source: Internet
Author: User

The official PHP image of the Docker hub https://hub.docker.com/_/php/
The instructions for use are:

As shown in the red box,
That means let me create a new docerfile in the PHP code directory, and then package the code and the downloaded PHP image together to build a newer image, is that what this means?
So that's a big mirror, and why put it all together? Isn't it good to be apart?
I don't understand, I got it wrong?
It's inconvenient to put together an update code and PHP, doesn't docker recommend that each service be placed separately? Why do you do this here? Please explain it to the great God.

Reply content:

The official PHP image of the Docker hub https://hub.docker.com/_/php/
The instructions for use are:

As shown in the red box,
That means let me create a new docerfile in the PHP code directory, and then package the code and the downloaded PHP image together to build a newer image, is that what this means?
So that's a big mirror, and why put it all together? Isn't it good to be apart?
I don't understand, I got it wrong?
It's inconvenient to put together an update code and PHP, doesn't docker recommend that each service be placed separately? Why do you do this here? Please explain it to the great God.

It seems that the Lord does not understand the operation mode of Docker.

First, this is the process of building the image using Dockerfile, the first sentence

FROM  php:5.6-cli

This image is built on the basis of the official php:5.6-cli image.

Well, based on this dockerfile, docker build a new image can be built using the command.
A container is initiated based on mirroring, and a mirror can start multiple containers.

COPYDirective puts the current directory's code inside the container's directory, and sets the WORKDIR specific meaning please refer to the official documentation.

The final CMD command is the Bash command to execute when the container starts.

Well, so far, the whole general process is like this.

On the working mechanism of Docker, the container is isolated from the host after it is started based on mirroring, so you have to put the code inside the container to use the internal PHP environment. In order to bypass the federated file system between multiple containers to achieve file sharing, please refer to the VOLUME instructions.

Docker is the process in which your code needs to be re-placed into a mirror, and if you want to make a PHP7 image yourself, look at this: Docker PHP7 Mirror

That means let me create a new docerfile in the PHP code directory, and then package the code and the downloaded PHP image together to build a newer image, is that what this means?

That's what it means, your understanding is fine.

So that's a big mirror, and why put it all together? Isn't it good to be apart?

Can be separated, or can not separate, depending on your needs.
Do not separate is in the Dockerfile copy folder into, separate words in the run image when you specify-V mount the local folder.
For example, if you do an outsourced project, you pack the code in the mirror, and then send the image to someone else, in which case you don't have to separate.
If you are in the process of developing a project, you can better develop the code and run the environment separately, otherwise change the code every time you need to pack.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.