How to install mcrypt on Docker












4















I have a Docker Container with Phalcon3 and php 7. I am trying to install the php extension Mcrypt without luck.



If I do ssh to the container, and execute:



apt-get update
apt-get install php7.0-mcrypt


I get the following:



E: Unable to locate package php7.0-mcrypt
E: Couldn't find any package by regex 'php7.0-mcrypt'


Is there a way to get it installed?










share|improve this question

























  • you should always begin with a apt-get update so try something along the lines of apt-get update && apt-get install -y php7.0-mcrypt the update first is necessary because you may use an OS (ubuntu, Debian or such) that has had many updates since its arrival. By the way, sudo is not necessary, you are root unless you do USER myuser

    – user2915097
    Nov 8 '17 at 14:08













  • have a look at hub.docker.com/r/phpdocker/phpdocker/~/dockerfile (and the line FROM php:7.1-fpm is built on Debian)

    – user2915097
    Nov 8 '17 at 14:10











  • @user2915097 Sorry, yes I do apt-get update, and you are right sudo is not necesary in fact it complains about it. I updated the commands. Also Im traying to modify an existing container, not creating a new one, as you recommend on your second comment.

    – subharb
    Nov 8 '17 at 14:45













  • Post the Dockerfile, it will be simpler

    – user2915097
    Nov 8 '17 at 15:05
















4















I have a Docker Container with Phalcon3 and php 7. I am trying to install the php extension Mcrypt without luck.



If I do ssh to the container, and execute:



apt-get update
apt-get install php7.0-mcrypt


I get the following:



E: Unable to locate package php7.0-mcrypt
E: Couldn't find any package by regex 'php7.0-mcrypt'


Is there a way to get it installed?










share|improve this question

























  • you should always begin with a apt-get update so try something along the lines of apt-get update && apt-get install -y php7.0-mcrypt the update first is necessary because you may use an OS (ubuntu, Debian or such) that has had many updates since its arrival. By the way, sudo is not necessary, you are root unless you do USER myuser

    – user2915097
    Nov 8 '17 at 14:08













  • have a look at hub.docker.com/r/phpdocker/phpdocker/~/dockerfile (and the line FROM php:7.1-fpm is built on Debian)

    – user2915097
    Nov 8 '17 at 14:10











  • @user2915097 Sorry, yes I do apt-get update, and you are right sudo is not necesary in fact it complains about it. I updated the commands. Also Im traying to modify an existing container, not creating a new one, as you recommend on your second comment.

    – subharb
    Nov 8 '17 at 14:45













  • Post the Dockerfile, it will be simpler

    – user2915097
    Nov 8 '17 at 15:05














4












4








4








I have a Docker Container with Phalcon3 and php 7. I am trying to install the php extension Mcrypt without luck.



If I do ssh to the container, and execute:



apt-get update
apt-get install php7.0-mcrypt


I get the following:



E: Unable to locate package php7.0-mcrypt
E: Couldn't find any package by regex 'php7.0-mcrypt'


Is there a way to get it installed?










share|improve this question
















I have a Docker Container with Phalcon3 and php 7. I am trying to install the php extension Mcrypt without luck.



If I do ssh to the container, and execute:



apt-get update
apt-get install php7.0-mcrypt


I get the following:



E: Unable to locate package php7.0-mcrypt
E: Couldn't find any package by regex 'php7.0-mcrypt'


Is there a way to get it installed?







docker mcrypt php-extension






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 '17 at 14:44







subharb

















asked Nov 8 '17 at 13:47









subharbsubharb

1,55862464




1,55862464













  • you should always begin with a apt-get update so try something along the lines of apt-get update && apt-get install -y php7.0-mcrypt the update first is necessary because you may use an OS (ubuntu, Debian or such) that has had many updates since its arrival. By the way, sudo is not necessary, you are root unless you do USER myuser

    – user2915097
    Nov 8 '17 at 14:08













  • have a look at hub.docker.com/r/phpdocker/phpdocker/~/dockerfile (and the line FROM php:7.1-fpm is built on Debian)

    – user2915097
    Nov 8 '17 at 14:10











  • @user2915097 Sorry, yes I do apt-get update, and you are right sudo is not necesary in fact it complains about it. I updated the commands. Also Im traying to modify an existing container, not creating a new one, as you recommend on your second comment.

    – subharb
    Nov 8 '17 at 14:45













  • Post the Dockerfile, it will be simpler

    – user2915097
    Nov 8 '17 at 15:05



















  • you should always begin with a apt-get update so try something along the lines of apt-get update && apt-get install -y php7.0-mcrypt the update first is necessary because you may use an OS (ubuntu, Debian or such) that has had many updates since its arrival. By the way, sudo is not necessary, you are root unless you do USER myuser

    – user2915097
    Nov 8 '17 at 14:08













  • have a look at hub.docker.com/r/phpdocker/phpdocker/~/dockerfile (and the line FROM php:7.1-fpm is built on Debian)

    – user2915097
    Nov 8 '17 at 14:10











  • @user2915097 Sorry, yes I do apt-get update, and you are right sudo is not necesary in fact it complains about it. I updated the commands. Also Im traying to modify an existing container, not creating a new one, as you recommend on your second comment.

    – subharb
    Nov 8 '17 at 14:45













  • Post the Dockerfile, it will be simpler

    – user2915097
    Nov 8 '17 at 15:05

















you should always begin with a apt-get update so try something along the lines of apt-get update && apt-get install -y php7.0-mcrypt the update first is necessary because you may use an OS (ubuntu, Debian or such) that has had many updates since its arrival. By the way, sudo is not necessary, you are root unless you do USER myuser

– user2915097
Nov 8 '17 at 14:08







you should always begin with a apt-get update so try something along the lines of apt-get update && apt-get install -y php7.0-mcrypt the update first is necessary because you may use an OS (ubuntu, Debian or such) that has had many updates since its arrival. By the way, sudo is not necessary, you are root unless you do USER myuser

– user2915097
Nov 8 '17 at 14:08















have a look at hub.docker.com/r/phpdocker/phpdocker/~/dockerfile (and the line FROM php:7.1-fpm is built on Debian)

– user2915097
Nov 8 '17 at 14:10





have a look at hub.docker.com/r/phpdocker/phpdocker/~/dockerfile (and the line FROM php:7.1-fpm is built on Debian)

– user2915097
Nov 8 '17 at 14:10













@user2915097 Sorry, yes I do apt-get update, and you are right sudo is not necesary in fact it complains about it. I updated the commands. Also Im traying to modify an existing container, not creating a new one, as you recommend on your second comment.

– subharb
Nov 8 '17 at 14:45







@user2915097 Sorry, yes I do apt-get update, and you are right sudo is not necesary in fact it complains about it. I updated the commands. Also Im traying to modify an existing container, not creating a new one, as you recommend on your second comment.

– subharb
Nov 8 '17 at 14:45















Post the Dockerfile, it will be simpler

– user2915097
Nov 8 '17 at 15:05





Post the Dockerfile, it will be simpler

– user2915097
Nov 8 '17 at 15:05












3 Answers
3






active

oldest

votes


















8














Lets look at official manual for php docker image Section PHP Core Extensions




For example, if you want to have a PHP-FPM image with iconv, mcrypt
and gd extensions, you can inherit the base image that you like, and
write your own Dockerfile like this:




FROM php:7.0-fpm
RUN apt-get update && apt-get install -y
libfreetype6-dev
libjpeg62-turbo-dev
libmcrypt-dev
libpng-dev
&& docker-php-ext-install -j$(nproc) iconv mcrypt
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
&& docker-php-ext-install -j$(nproc) gd



Rember, you must install dependencies for your extensions manually. If
an extension needs custom configure arguments, you can use the
docker-php-ext-configure script like this example. There is no need to
run docker-php-source manually in this case, since that is handled by
the configure and install scripts.







share|improve this answer





















  • 1





    Thank you that was great help. You can also ssh on the container and execute that same command: apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev && docker-php-ext-install -j$(nproc) iconv mcrypt && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd

    – subharb
    Nov 9 '17 at 7:47



















4














From PHP manual:



This extension has been moved to the » PECL repository and is no longer bundled with PHP as of PHP 7.2.0.



So in your Dockerfile you have to:



RUN apt-get install libmcrypt-dev
RUN pecl install mcrypt-1.0.1 && docker-php-ext-enable mcrypt





share|improve this answer
























  • Seems to work, but under Lando not completely. Or do I need add something there? stackoverflow.com/questions/54752814/…

    – ñull
    Feb 18 at 17:57



















3














i added the code to my Dockerfile but i get this Error



error: /usr/src/php/ext/mcrypt does not exist





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47181369%2fhow-to-install-mcrypt-on-docker%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    8














    Lets look at official manual for php docker image Section PHP Core Extensions




    For example, if you want to have a PHP-FPM image with iconv, mcrypt
    and gd extensions, you can inherit the base image that you like, and
    write your own Dockerfile like this:




    FROM php:7.0-fpm
    RUN apt-get update && apt-get install -y
    libfreetype6-dev
    libjpeg62-turbo-dev
    libmcrypt-dev
    libpng-dev
    && docker-php-ext-install -j$(nproc) iconv mcrypt
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
    && docker-php-ext-install -j$(nproc) gd



    Rember, you must install dependencies for your extensions manually. If
    an extension needs custom configure arguments, you can use the
    docker-php-ext-configure script like this example. There is no need to
    run docker-php-source manually in this case, since that is handled by
    the configure and install scripts.







    share|improve this answer





















    • 1





      Thank you that was great help. You can also ssh on the container and execute that same command: apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev && docker-php-ext-install -j$(nproc) iconv mcrypt && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd

      – subharb
      Nov 9 '17 at 7:47
















    8














    Lets look at official manual for php docker image Section PHP Core Extensions




    For example, if you want to have a PHP-FPM image with iconv, mcrypt
    and gd extensions, you can inherit the base image that you like, and
    write your own Dockerfile like this:




    FROM php:7.0-fpm
    RUN apt-get update && apt-get install -y
    libfreetype6-dev
    libjpeg62-turbo-dev
    libmcrypt-dev
    libpng-dev
    && docker-php-ext-install -j$(nproc) iconv mcrypt
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
    && docker-php-ext-install -j$(nproc) gd



    Rember, you must install dependencies for your extensions manually. If
    an extension needs custom configure arguments, you can use the
    docker-php-ext-configure script like this example. There is no need to
    run docker-php-source manually in this case, since that is handled by
    the configure and install scripts.







    share|improve this answer





















    • 1





      Thank you that was great help. You can also ssh on the container and execute that same command: apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev && docker-php-ext-install -j$(nproc) iconv mcrypt && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd

      – subharb
      Nov 9 '17 at 7:47














    8












    8








    8







    Lets look at official manual for php docker image Section PHP Core Extensions




    For example, if you want to have a PHP-FPM image with iconv, mcrypt
    and gd extensions, you can inherit the base image that you like, and
    write your own Dockerfile like this:




    FROM php:7.0-fpm
    RUN apt-get update && apt-get install -y
    libfreetype6-dev
    libjpeg62-turbo-dev
    libmcrypt-dev
    libpng-dev
    && docker-php-ext-install -j$(nproc) iconv mcrypt
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
    && docker-php-ext-install -j$(nproc) gd



    Rember, you must install dependencies for your extensions manually. If
    an extension needs custom configure arguments, you can use the
    docker-php-ext-configure script like this example. There is no need to
    run docker-php-source manually in this case, since that is handled by
    the configure and install scripts.







    share|improve this answer















    Lets look at official manual for php docker image Section PHP Core Extensions




    For example, if you want to have a PHP-FPM image with iconv, mcrypt
    and gd extensions, you can inherit the base image that you like, and
    write your own Dockerfile like this:




    FROM php:7.0-fpm
    RUN apt-get update && apt-get install -y
    libfreetype6-dev
    libjpeg62-turbo-dev
    libmcrypt-dev
    libpng-dev
    && docker-php-ext-install -j$(nproc) iconv mcrypt
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
    && docker-php-ext-install -j$(nproc) gd



    Rember, you must install dependencies for your extensions manually. If
    an extension needs custom configure arguments, you can use the
    docker-php-ext-configure script like this example. There is no need to
    run docker-php-source manually in this case, since that is handled by
    the configure and install scripts.








    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 8 '17 at 18:10

























    answered Nov 8 '17 at 15:51









    Bukharov SergeyBukharov Sergey

    4,43711839




    4,43711839








    • 1





      Thank you that was great help. You can also ssh on the container and execute that same command: apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev && docker-php-ext-install -j$(nproc) iconv mcrypt && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd

      – subharb
      Nov 9 '17 at 7:47














    • 1





      Thank you that was great help. You can also ssh on the container and execute that same command: apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev && docker-php-ext-install -j$(nproc) iconv mcrypt && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd

      – subharb
      Nov 9 '17 at 7:47








    1




    1





    Thank you that was great help. You can also ssh on the container and execute that same command: apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev && docker-php-ext-install -j$(nproc) iconv mcrypt && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd

    – subharb
    Nov 9 '17 at 7:47





    Thank you that was great help. You can also ssh on the container and execute that same command: apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng-dev && docker-php-ext-install -j$(nproc) iconv mcrypt && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd

    – subharb
    Nov 9 '17 at 7:47













    4














    From PHP manual:



    This extension has been moved to the » PECL repository and is no longer bundled with PHP as of PHP 7.2.0.



    So in your Dockerfile you have to:



    RUN apt-get install libmcrypt-dev
    RUN pecl install mcrypt-1.0.1 && docker-php-ext-enable mcrypt





    share|improve this answer
























    • Seems to work, but under Lando not completely. Or do I need add something there? stackoverflow.com/questions/54752814/…

      – ñull
      Feb 18 at 17:57
















    4














    From PHP manual:



    This extension has been moved to the » PECL repository and is no longer bundled with PHP as of PHP 7.2.0.



    So in your Dockerfile you have to:



    RUN apt-get install libmcrypt-dev
    RUN pecl install mcrypt-1.0.1 && docker-php-ext-enable mcrypt





    share|improve this answer
























    • Seems to work, but under Lando not completely. Or do I need add something there? stackoverflow.com/questions/54752814/…

      – ñull
      Feb 18 at 17:57














    4












    4








    4







    From PHP manual:



    This extension has been moved to the » PECL repository and is no longer bundled with PHP as of PHP 7.2.0.



    So in your Dockerfile you have to:



    RUN apt-get install libmcrypt-dev
    RUN pecl install mcrypt-1.0.1 && docker-php-ext-enable mcrypt





    share|improve this answer













    From PHP manual:



    This extension has been moved to the » PECL repository and is no longer bundled with PHP as of PHP 7.2.0.



    So in your Dockerfile you have to:



    RUN apt-get install libmcrypt-dev
    RUN pecl install mcrypt-1.0.1 && docker-php-ext-enable mcrypt






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 25 '18 at 9:17









    thanosasimothanosasimo

    594




    594













    • Seems to work, but under Lando not completely. Or do I need add something there? stackoverflow.com/questions/54752814/…

      – ñull
      Feb 18 at 17:57



















    • Seems to work, but under Lando not completely. Or do I need add something there? stackoverflow.com/questions/54752814/…

      – ñull
      Feb 18 at 17:57

















    Seems to work, but under Lando not completely. Or do I need add something there? stackoverflow.com/questions/54752814/…

    – ñull
    Feb 18 at 17:57





    Seems to work, but under Lando not completely. Or do I need add something there? stackoverflow.com/questions/54752814/…

    – ñull
    Feb 18 at 17:57











    3














    i added the code to my Dockerfile but i get this Error



    error: /usr/src/php/ext/mcrypt does not exist





    share|improve this answer




























      3














      i added the code to my Dockerfile but i get this Error



      error: /usr/src/php/ext/mcrypt does not exist





      share|improve this answer


























        3












        3








        3







        i added the code to my Dockerfile but i get this Error



        error: /usr/src/php/ext/mcrypt does not exist





        share|improve this answer













        i added the code to my Dockerfile but i get this Error



        error: /usr/src/php/ext/mcrypt does not exist






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 23 '18 at 6:54









        Dennis SchafferDennis Schaffer

        667




        667






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47181369%2fhow-to-install-mcrypt-on-docker%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Tonle Sap (See)

            I get strange results when I access the Sqlitedatabase with Unity C# via XAMPP

            Guatemaltekische Davis-Cup-Mannschaft