7

How to run PHP in a container :
1. Begin a docker file for an existing php cron app (when all you know is php, everything looks like a php app)
2. Set the FROM.. Apt get update .. Do composer install
3. Builds the image
4. Discover I need git
5. Add git to apt get install step
6. Builds the image
7. Launch the php script
8. Fatal : use of undefined constant SOL_UDP
9. Opens the source code of the third party. The there's no mention of where that constant is from.
10. Spend many minutes online to find what's missing.
11. Find the PHP sockets page about that option. Digs into the documentation to find out that's missing from the installed PHP.
12. Find out I need to add a step to install the socket extension in my docker file.
13. Build the image again
14. Execute it, finally it works
15. Remember why I hate php
(for brevity I've omitted the even more complex part of having to set up zlib)

How to install node js in a container image:
FROM node:8
ADD package.json
RUN npm install

Comments
  • 0
    Or you get the php container...
  • 0
    @Codex404 that's based on the official php image
  • 2
    But is PHP the one to blame here though? Just sounds like someone didn't read the instructions.
  • 0
    @olback there is no instructions
  • 0
    @assertnotnull there are no instructions? Ive found about 80 blogposts last time I used php.

    It seems like you are a javascript fanatic throwing lies about PHP around. If you dont like something thats fine, but blame your ignorance for "not being enough documentation" instead of blaming the language.
  • 0
    @Codex404 no instructions as in: the readme file is empty.

    Good that you found blog post for what you know what to do. I blame that you can't use your intuition to get it working. In this case the errors are misleading (missing const SOL_UDP) and installing zlib here are the instructions: https://secure.php.net/manual/en/... . Actually I prefer Python but thanks.
  • 0
    @assertnotnull well you said something with node in comparison. Have made a few php containers from scratch and a few node containers, same level of difficulty.

    Personally I like C# more.
Add Comment