In Docker, should I reuse base images if possible?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite












I am starting using Docker for my Kubuntu desktop.
As I am following the tutorials, it has been helping me understanding how this works, but I am stuck with the following situation:



I would like to deploy containers for at least these three:



  • Web server (Apache)

  • SQL-compatible database (MariaDB/MySQL)

  • Java custom SDK (OpenSDK-based)

Searching for how-tos, people highly recommend using Alpine-based base images as they only use 5-6 MB of disk storage, which is pretty good. And that would solve my problems for the web server and the database as long as there are already made base images in the Docker Hub.



But the problem is with the Java SDK, where I just build my very own customized development environment which needs to use a Ubuntu 16.04 base image. (I could port it to Alpine, but there would be too many problems that I would not like to solve).



If I understood how Docker works, if multiple dockerfiles are using the same base image, this is not necessary to be downloaded again, as it would be used by every container that require it.



Then, would be a good idea to use that Ubuntu 16.04 base image to also deploy the web server and the database (and more containers, if any)? Because using the mentioned Alpine versions in the Docker Hub would need to download their Alpine base images too (even if they are only 5 MB).



Thanks in advance.




Just to clarify: I DO NOT want to change the tools I am currently using, that is not the question, I just want to understand Docker and good practices with it.








share|improve this question
























    up vote
    0
    down vote

    favorite












    I am starting using Docker for my Kubuntu desktop.
    As I am following the tutorials, it has been helping me understanding how this works, but I am stuck with the following situation:



    I would like to deploy containers for at least these three:



    • Web server (Apache)

    • SQL-compatible database (MariaDB/MySQL)

    • Java custom SDK (OpenSDK-based)

    Searching for how-tos, people highly recommend using Alpine-based base images as they only use 5-6 MB of disk storage, which is pretty good. And that would solve my problems for the web server and the database as long as there are already made base images in the Docker Hub.



    But the problem is with the Java SDK, where I just build my very own customized development environment which needs to use a Ubuntu 16.04 base image. (I could port it to Alpine, but there would be too many problems that I would not like to solve).



    If I understood how Docker works, if multiple dockerfiles are using the same base image, this is not necessary to be downloaded again, as it would be used by every container that require it.



    Then, would be a good idea to use that Ubuntu 16.04 base image to also deploy the web server and the database (and more containers, if any)? Because using the mentioned Alpine versions in the Docker Hub would need to download their Alpine base images too (even if they are only 5 MB).



    Thanks in advance.




    Just to clarify: I DO NOT want to change the tools I am currently using, that is not the question, I just want to understand Docker and good practices with it.








    share|improve this question






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am starting using Docker for my Kubuntu desktop.
      As I am following the tutorials, it has been helping me understanding how this works, but I am stuck with the following situation:



      I would like to deploy containers for at least these three:



      • Web server (Apache)

      • SQL-compatible database (MariaDB/MySQL)

      • Java custom SDK (OpenSDK-based)

      Searching for how-tos, people highly recommend using Alpine-based base images as they only use 5-6 MB of disk storage, which is pretty good. And that would solve my problems for the web server and the database as long as there are already made base images in the Docker Hub.



      But the problem is with the Java SDK, where I just build my very own customized development environment which needs to use a Ubuntu 16.04 base image. (I could port it to Alpine, but there would be too many problems that I would not like to solve).



      If I understood how Docker works, if multiple dockerfiles are using the same base image, this is not necessary to be downloaded again, as it would be used by every container that require it.



      Then, would be a good idea to use that Ubuntu 16.04 base image to also deploy the web server and the database (and more containers, if any)? Because using the mentioned Alpine versions in the Docker Hub would need to download their Alpine base images too (even if they are only 5 MB).



      Thanks in advance.




      Just to clarify: I DO NOT want to change the tools I am currently using, that is not the question, I just want to understand Docker and good practices with it.








      share|improve this question












      I am starting using Docker for my Kubuntu desktop.
      As I am following the tutorials, it has been helping me understanding how this works, but I am stuck with the following situation:



      I would like to deploy containers for at least these three:



      • Web server (Apache)

      • SQL-compatible database (MariaDB/MySQL)

      • Java custom SDK (OpenSDK-based)

      Searching for how-tos, people highly recommend using Alpine-based base images as they only use 5-6 MB of disk storage, which is pretty good. And that would solve my problems for the web server and the database as long as there are already made base images in the Docker Hub.



      But the problem is with the Java SDK, where I just build my very own customized development environment which needs to use a Ubuntu 16.04 base image. (I could port it to Alpine, but there would be too many problems that I would not like to solve).



      If I understood how Docker works, if multiple dockerfiles are using the same base image, this is not necessary to be downloaded again, as it would be used by every container that require it.



      Then, would be a good idea to use that Ubuntu 16.04 base image to also deploy the web server and the database (and more containers, if any)? Because using the mentioned Alpine versions in the Docker Hub would need to download their Alpine base images too (even if they are only 5 MB).



      Thanks in advance.




      Just to clarify: I DO NOT want to change the tools I am currently using, that is not the question, I just want to understand Docker and good practices with it.










      share|improve this question











      share|improve this question




      share|improve this question










      asked May 24 at 21:18









      Davdriver

      430216




      430216




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          Yes, if you use the same base image for all three containers, you save on disk space, since that base layer is common to the three images. This said, Alpine isn't that big, so if your DB & Apache images are Alpine-based, this isn't as bad as it looks. But if you use a volume container (for instance to provide static content to the Apache server) you can base it on any of your existing images, and the only disk space it will use will be for the content you add.






          share|improve this answer




















          • This is exactly the answer I was looking for. Well, of course Alpine is tiny compared to Ubuntu, that is why I made the question. I have been installing and configuring these apps for long time over Debian-based systems, and in this scenario, I thought that could be a good reason to stay. I seem to have understood well how this Docker system works. Thanks again.
            – Davdriver
            May 24 at 22:31










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "89"
          ;
          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',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1039992%2fin-docker-should-i-reuse-base-images-if-possible%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          Yes, if you use the same base image for all three containers, you save on disk space, since that base layer is common to the three images. This said, Alpine isn't that big, so if your DB & Apache images are Alpine-based, this isn't as bad as it looks. But if you use a volume container (for instance to provide static content to the Apache server) you can base it on any of your existing images, and the only disk space it will use will be for the content you add.






          share|improve this answer




















          • This is exactly the answer I was looking for. Well, of course Alpine is tiny compared to Ubuntu, that is why I made the question. I have been installing and configuring these apps for long time over Debian-based systems, and in this scenario, I thought that could be a good reason to stay. I seem to have understood well how this Docker system works. Thanks again.
            – Davdriver
            May 24 at 22:31














          up vote
          1
          down vote



          accepted










          Yes, if you use the same base image for all three containers, you save on disk space, since that base layer is common to the three images. This said, Alpine isn't that big, so if your DB & Apache images are Alpine-based, this isn't as bad as it looks. But if you use a volume container (for instance to provide static content to the Apache server) you can base it on any of your existing images, and the only disk space it will use will be for the content you add.






          share|improve this answer




















          • This is exactly the answer I was looking for. Well, of course Alpine is tiny compared to Ubuntu, that is why I made the question. I have been installing and configuring these apps for long time over Debian-based systems, and in this scenario, I thought that could be a good reason to stay. I seem to have understood well how this Docker system works. Thanks again.
            – Davdriver
            May 24 at 22:31












          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          Yes, if you use the same base image for all three containers, you save on disk space, since that base layer is common to the three images. This said, Alpine isn't that big, so if your DB & Apache images are Alpine-based, this isn't as bad as it looks. But if you use a volume container (for instance to provide static content to the Apache server) you can base it on any of your existing images, and the only disk space it will use will be for the content you add.






          share|improve this answer












          Yes, if you use the same base image for all three containers, you save on disk space, since that base layer is common to the three images. This said, Alpine isn't that big, so if your DB & Apache images are Alpine-based, this isn't as bad as it looks. But if you use a volume container (for instance to provide static content to the Apache server) you can base it on any of your existing images, and the only disk space it will use will be for the content you add.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 24 at 22:22









          xenoid

          764313




          764313











          • This is exactly the answer I was looking for. Well, of course Alpine is tiny compared to Ubuntu, that is why I made the question. I have been installing and configuring these apps for long time over Debian-based systems, and in this scenario, I thought that could be a good reason to stay. I seem to have understood well how this Docker system works. Thanks again.
            – Davdriver
            May 24 at 22:31
















          • This is exactly the answer I was looking for. Well, of course Alpine is tiny compared to Ubuntu, that is why I made the question. I have been installing and configuring these apps for long time over Debian-based systems, and in this scenario, I thought that could be a good reason to stay. I seem to have understood well how this Docker system works. Thanks again.
            – Davdriver
            May 24 at 22:31















          This is exactly the answer I was looking for. Well, of course Alpine is tiny compared to Ubuntu, that is why I made the question. I have been installing and configuring these apps for long time over Debian-based systems, and in this scenario, I thought that could be a good reason to stay. I seem to have understood well how this Docker system works. Thanks again.
          – Davdriver
          May 24 at 22:31




          This is exactly the answer I was looking for. Well, of course Alpine is tiny compared to Ubuntu, that is why I made the question. I have been installing and configuring these apps for long time over Debian-based systems, and in this scenario, I thought that could be a good reason to stay. I seem to have understood well how this Docker system works. Thanks again.
          – Davdriver
          May 24 at 22:31












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1039992%2fin-docker-should-i-reuse-base-images-if-possible%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Trouble downloading packages list due to a “Hash sum mismatch” error

          How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

          How do I move numbers in filenames, in a batch renaming operation?