Posts by TheSidewinder

    I never said it did... I was just pointing out that it was clear how to update Plex if you just read the page. However, putting an environment variable as an extra argument, is absolutely not right.


    Then we'll have to agree to disagree about that point.


    I had "-e VERSION=docker" and it did not update Plex after a number of machine restarts or container/image restarts. My Plex web interface still said an update was available. That's when I started digging for more info.


    I don't remember now where I found the information to use that string "-e VERSION=latest" as an extra argument, but.... it worked.


    Once I changed that to "-e VERSION=latest", on the next machine restart (or container restart, I forget which) it updated Plex.


    I'm using OMV 4.x and the relevant Docker, not the Plex plugin in OMV extras, if that matters.

    I don't use Plex, but if you do what you were told earlier and looked at the docker info, you would know your pic shows where you went wrong. First, fix what you messed up. Where put "-e VERSION=latest" as an extra argument, is wrong. Delete that.
    Now, go here https://hub.docker.com/r/linuxserver/plex/ , and look at the docker-compose section.


    See that part that says "-e VERSION=docker"... Now scroll down to Parameters, and where it describes "-e VERSION=docker".. What's it say there... "Set whether to update plex or not - see Application Setup section."

    That's not "wrong".


    Using VERSION=docker will update Plex to the latest version that Docker has, but that's not necessarily the latest version of Plex.

    Quite some time ago, I noticed that my Plex interface was telling me an update was available, so I first used VERSION=docker and it did not update. I then changed it to VERSION=latest and then Plex updated on the next boot.

    Plex has not shown me that an update was available ever since then, so it's updating as updates become available.


    Your mileage may vary.

    If you are running Plex in Docker, in the "Extra Arguments" section, add the value:


    -e VERSION=latest


    as below. Save and restart Plex. That should update it automatically to the latest version available (for the Docker Image named "linuxserver/plex" anyway)


    updateplex.png
    Iv'e had that in place for some time now and it works on my install.

    Yes but you are getting away from the concept of docker.

    I tried adding that line to Dockerfile as my image showed, and while it didn't produce any errors during the build, cron was not running when the container started. This was the same result when I earlier tried adding the line "&& service cron restart \" to the Dockerfile.


    At this point I think I'll try and muddle my way through creating a cron docker from the example you posted.


    And thank you for trying to help, I do appreciate it.

    I must be confused about how containers interact with one another.... pardon some rambling with my observations this morning.


    First, my container is named "webserver" and contains the items/programs in that topic I linked in my first post.


    1) If I use /usr/sbin/cron -f from the "webserver" container shell, that results in the command prompt never coming back:


    cron-result.png


    until I use CTRL-C. However, cron is running at that point; it shows up in "top" whereas before it did not.


    But running /usr/sbin/cron (without the -f) does work, the command prompt does comes back, and it does start cron (which shows in "top" whereas it did not before).


    What is the "-f" parameter doing?


    2) I guess I'm not seeing the difference between my command "service start (or restart) cron" and your suggested command "/usr/sbin/cron" (with or without the -f) with respect to getting either command to run at startup. They both produce the same result; cron is then running after either command is executed.


    I already have the cron job entered for the user "www-data" (the account which my software uses to run), the job is persistent between reboots (crontab -l -u www-data shows it in place), and once I get cron started, the cron job works as required.


    3) Can what I want to do be accomplished simply by adding a line to the Dockerfile I made previously, perhaps right before the end of the file, and recreating the container from the image? Something like this, using your command and formatted properly as "&& /usr/sbin/cron \"?


    addition-to-dockerfile.png

    It's running a command every minute which my php software needs to maintain its database and the information within it.


    Code
    /usr/local/bin/php -d memory_limit=-1 -d max_execution_time=0 /var/www/html/applications/core/interface/task/task.php ccxxxxxxxxxxxxxxxxxxxxxxxxxxxxaf

    (The task ID at the end of the line above is redacted for security.)



    And that's what I did do. Check the most-recent Dockerfile I posted in that topic.


    Cron is installed, but for some reason does not appear to be actually running. Or at least not running correctly.


    When I issue the restart command, note what it says on the first line.


    service cron restart
    [....] Restarting periodic command scheduler: cron[....] Stopping periodic command scheduler: cron/sbin/start-stop-daemon: warning: failed to kill 77: No such process
    . ok
    [ ok ] Starting periodic command scheduler: cron.


    If I run "top" before I perform the restart, cron is not listed. After I issue the command, top does show it.


    That's why I just want to issue the service restart command and be done with it, lol.

    Hmm... well I have cron installed and active in the container I created, "my-php-custom:latest" and with which you greatly helped, thanks again. ( Here's a working PHP 7.x and Apache setup for Docker )


    I just need some way to run this command:


    service cron restart


    at startup of that container, but see no way to do that.


    I can SSH into that container with "docker exec -it webserver bash" and run the command, so I know that command works. Is there no way to "automate" that within the container?


    If not, how would I run cron in its own container? Searching available docker images shows a few results but I have yet to find one with any meaningful documentation.


    (And since I already have cron working in my container, I'm fearful of interference by a new instance of it.)

    Thanks for trying to help, but I entered that command within the container running PHP/Apache in Docker, and it says systemctl is not a valid command.



    docker exec -it webserver bash ("webserver" is my container's name, and this command gets me into the container via shell)


    systemctl enable crond.service


    bash: systemctl: command not found


    In that container, rc.d and rc.local don't exist, though there are /etc/rc0.d, rc1.d..... rc6.d and rcS.d folders with what appears to be init-type symlinked commands in them.


    One odd thing is that in the container, if I enter "service cron restart" it first says the process it tries to kill doesn't exist, then it starts cron normally:


    ervice cron restart
    [....] Restarting periodic command scheduler: cron[....] Stopping periodic command scheduler: cron/sbin/start-stop-daemon: warning: failed to kill 77: No such process
    . ok
    [ ok ] Starting periodic command scheduler: cron.



    Has me baffled.

    This is a nagging little thing I can't seem to get sorted out, but per the last post in my topic here:


    Here's a working PHP 7.x and Apache setup for Docker


    I have a PHP/Apache container in which cron in installed, but for some reason cron is not auto-starting on container startup. It works great other than this one issue.


    Can someone tell me how to either:


    1) build the container such that cron auto-starts, or


    2) at startup of the built container, pass this command to it as (or preferably 10-30 seconds after) it starts: "service cron restart"


    Thanks in advance.

    UPDATE:


    If you want to add cron and nano to the container build (the native php Docker image does not contain them), use the following Dockerfile, and read the notes below it; cron is a bit fussy.



    NOTE: cron cannot be installed in the first "apt-get install" block, because some of what is installed with that first run, itself needs to have "apt-get update" run again, as shown later in the file.


    FURTHER NOTE: For some reason I cannot get cron to auto-start after a crontab edit, and I use a software package which first must run. to give you the cron job to enter.


    For these reasons, I use the following process to get the job in place, and get it running within cron. If I find a solution that gets cron to auto-start on container start, I'll update this topic.


    Using SSH or shellinabox run "docker exec -it <Container-Name> bash" (<Container-Name> is the name of the container you used when first running the image. I used "webserver" in my build, so the line I enter is: docker exec -it webserver bash)


    At the next prompt, which will look similar to this:


    root@90d943253d56:/var/www/html#


    run this command:


    crontab -e -uwww-data (note: www-data seems to be the native default account which PHP/Apache uses for .php files; it's the account my software uses, anyway)


    Once in nano, you'll see a placeholder file:



    (The bottom line is my cron job, set to run every minute)



    Press ctrl-x and then press y to save


    Finally, from the prompt, run:


    service cron restart


    and you should see:


    [ ok ] Restarting periodic command scheduler: cron[....] Stopping periodic command scheduler: cron.
    [ ok ] Starting periodic command scheduler: cron.



    FINAL NOTE: Whenever you restart your server or the Container, you will need to restart cron either by Run Cmd in the container in OMV->Docker, or with SSH.
    I'm not sure why it's happening, but I have to restart it as it isn't auto-starting on container startup.

    Maybe someone can comment with what's needed? I'll edit this and credit you.

    One more thing to consider.....


    If the computer(s) you wish to protect with a UPS have power supplies with their own DSP (Digital Signal Processor, usually only found on high-end PSU's), make certain the UPS you purchase has a true sine wave output, and not a stepped output.


    Some power supplies with DSP's can handle a stepped wave, but most cannot, and you risk damage to them.


    APC UPS's come in two basic forms, those with true sine wave output (which are more expensive) and those with stepped output. I believe CyberPower UPS's are the same, but I am not familiar with their offerings.

    That worked perfectly, thank you again! I'll put the final iteration of the build below for anyone interested.


    For anyone reading this at a later date, here is the Dockerfile for installing Apache/PHP 7.3.2 with Exif, gd, mysqli, the Zip PHP extension, and mod_rewrite.


    It also has post_max_size set to 257 MB, upload_max_filesize set to 256 MB, and a PHP memory_limit of 512 MB, as well as disabling a number of functions that are recommended to be disabled (for my software anyway) and display_errors disabled (Off).

    You can adjust those limits as appropriate for your needs, or remove the lines which are not needed, but remember that the first echo line should have a single ">" and subsequent echo lines have two of them like so: ">>" (Because > in echo overwrites the file, while >> appends to the file).




    From command-line (SSH), first pull PHP with this command:


    Code
    docker pull php

    Then from command-line (SSH or shellinabox), and in the folder where you placed the file named "Dockerfile", run this command:


    Code
    docker build -t my-php-custom .

    (Or whatever image name you prefer, if you don't want to name it "my-php-custom".)


    Once done you can configure it in the usual fashion. Use a Container Name of your choosing, Restart Policy as you prefer. You can leave Host Name blank if you wish, it will auto-populate a name.


    I use my machines internally assigned IP Address, with the Host Port = 80, Exposed Port = 80/tcp.


    Host Path is the volume and folder where you will place your .php web script(s), HTML pages, etc. Container Path should be set to /var/www/html


    Here's a screenshot of my setup for reference. I suspect you can change some of the values to suit your own needs, but these work for me so I'll stick with them:


    my-php-custom.pngHope this helps someone else!

    Not sure what you mean by "create settings files in /usr/local/etc/php/conf.d/."


    Using SSH, I see there is a /usr/local/etc/ folder but nothing in it.


    So I created /usr/local/etc/php/ and /usr/local/etc/php/conf.d/ then did a Run Cmd twice in the container with:


    echo "upload_max_filesize = 128M" > /usr/local/etc/php/conf.d/maxsizes.ini


    followed by


    echo "post_max_size = 129M" >> /usr/local/etc/php/conf.d/maxsizes.ini


    and that file was created with the two lines.



    Code
    root@debian:/usr/local/etc/php/conf.d# ls -la
    total 12
    drwxr-sr-x 2 root staff 4096 Mar 5 13:02 .
    drwxr-sr-x 3 root staff 4096 Mar 5 13:01 ..
    -rw-rw-rw- 1 root staff 50 Mar 5 13:02 maxsizes.ini
    root@debian:/usr/local/etc/php/conf.d# cat maxsizes.ini
    upload_max_filesize = 128M
    post_max_size = 129M
    root@debian:/usr/local/etc/php/conf.d#

    But phpinfo in my software shows no change.


    Do I have to actually build this container again, adding those two lines as you showed them, to my Dockerfile file? (Easy enough to do, I just want to be sure.)

    That worked perfectly.


    And it's a bit odd, because I had that exact contents, but with the "a2enmod rewrite" line after the exif line. And I did have a trailing \ as well.


    I'll update my post.


    One last question, if you know..... where is the phpi.in file located within this container?


    I'd like to setup some "disable_functions" and increase a few of the default parameters like post_max_size and upoad_max_filesize, but am running into a dead end.


    In my software, phpinfo shows a lot of directories/folders that simply don't exist on disk when viewed with command-line SSH.


    This isn't a "must do", just something I'd prefer to do.

    Hmm... no, I didn't, I just ran it based on a Google search result.
    I'll try that right now and edit my post if it does the trick, thanks!


    EDIT: That failed with the error:


    Error response from daemon: Dockerfile parse error line 15: unknown instruction: && (or line number 12 in another attempt)


    Not sure why. I tried positioning it a few lines up and appending a / on the line, but it failed there as well.


    Here's the end of the Dockerfile with both attempts:


    Code
    && docker-php-ext-install gd \
    && docker-php-ext-install exif \
    && apt-get clean \
    && rm -r /var/lib/apt/lists/*
    && a2endmod rewrite



    Code
    && docker-php-ext-install gd \
    && docker-php-ext-install exif \
    && a2endmod rewrite \
    && apt-get clean \
    && rm -r /var/lib/apt/lists/*

    Not sure what's up there.