Looking for new opportunities
I am always looking for a new opportunities to expand my knowledge and help others while doing so, there for if you are looking for someone to join your team or you have something you want some help with feel free to reach out via email zaher[@]zah.me.
Note: Please note that this is just a post to express something within my head, you may agree or don't agree with it, but this does not make you nor me wrong. We just have our own ideas.
Every single post I ever read about "Docker best practice" talked about two main points, having a smaller image and having a single service image.
Having a smaller image, is something you can easily achieve by using Alpine Linux as your image base, and trust me not everyone is ready or want to do that I worked with people who switched to Ubuntu at the first problem they faced with Alpine, but now even Ubuntu have a smaller image, not as small as alpine btw.
Again, for each case there is a case where you cant have a minimal image, check "Building a very minimal Docker image for Ruby is very hard." via @codeship
Meanwhile, having a single service image is not something you can easily achieve, yes it is easy to do it with Nodejs or even Python (if am not mistaken), but when it comes to PHP you will always need something like Apache or Nginx to be installed within your image, and yes there are two types of people here, one who said no you can have everything separated and one who said why the hassle just have them in one image.
In my experience having PHP + Web server (Apache or Nginx) in the same image is not a big deal, and yes you can consider it as the best practice at the end there are other factors you will need to think of when building/deploying your images.
For example, when they said you should build a smaller image, they want to speed up your build/deploy time, not space, nowadays space is cheap but deploying fast is not. So you can think of this in the same way, it will take extra time to build/deploy two images than building/deploying one.
Also remember, the Web server needs to have access to your public folder, so if you are building two images, you will need to pull some of your code to the web server image, which may cause rare issues when one of the images fail to deploy (especially the web server one as it will hold the assets), meanwhile the code image was deployed.
This can be nice locally when you are developing your app on your machine, but in reality it's not nice.
Am not going over scalability as this topic may be different based on the orchestration you will use.
So in general, don't hold your self on the idea that your PHP image has Nginx/Apache within it, it is what it is, so just do it and move on.