Does a docker image build on MacOS can be deployed to another OS like Linux?











up vote
0
down vote

favorite












I just got started with docker. To my understanding, docker container runs a discrete process on the host machine and shares system resources of host machine too to that process, and as we know, codes building for Linux may not able to run on MacOS, and vice versa. My question is: can a docker image built on an OS platform can be deployed to another OS, like MacOS to Linux, or Ubuntu to CentOS?



If the question is NO, how come it only has one official mysql image on docker repositories, but not multiple like for Mac, for Ubuntu, for RHEL?










share|improve this question









New contributor




Kaibin Lin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    0
    down vote

    favorite












    I just got started with docker. To my understanding, docker container runs a discrete process on the host machine and shares system resources of host machine too to that process, and as we know, codes building for Linux may not able to run on MacOS, and vice versa. My question is: can a docker image built on an OS platform can be deployed to another OS, like MacOS to Linux, or Ubuntu to CentOS?



    If the question is NO, how come it only has one official mysql image on docker repositories, but not multiple like for Mac, for Ubuntu, for RHEL?










    share|improve this question









    New contributor




    Kaibin Lin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I just got started with docker. To my understanding, docker container runs a discrete process on the host machine and shares system resources of host machine too to that process, and as we know, codes building for Linux may not able to run on MacOS, and vice versa. My question is: can a docker image built on an OS platform can be deployed to another OS, like MacOS to Linux, or Ubuntu to CentOS?



      If the question is NO, how come it only has one official mysql image on docker repositories, but not multiple like for Mac, for Ubuntu, for RHEL?










      share|improve this question









      New contributor




      Kaibin Lin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I just got started with docker. To my understanding, docker container runs a discrete process on the host machine and shares system resources of host machine too to that process, and as we know, codes building for Linux may not able to run on MacOS, and vice versa. My question is: can a docker image built on an OS platform can be deployed to another OS, like MacOS to Linux, or Ubuntu to CentOS?



      If the question is NO, how come it only has one official mysql image on docker repositories, but not multiple like for Mac, for Ubuntu, for RHEL?







      docker






      share|improve this question









      New contributor




      Kaibin Lin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Kaibin Lin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited Nov 5 at 4:08









      Joel

      1,3945719




      1,3945719






      New contributor




      Kaibin Lin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 5 at 2:13









      Kaibin Lin

      11




      11




      New contributor




      Kaibin Lin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Kaibin Lin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Kaibin Lin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote













          Docker on mac works by creating a linux virtual machine. So a docker image built on Mac is in fact built on a linux virtual machine and can be freely exchanged with most other docker systems - including most docker on windows.
          There is a windows version of dockers that is not linux based. Those images are not interchangeable.






          share|improve this answer




























            up vote
            0
            down vote













            Docker images are platform agnostic. The first thing a Dockerfile declares is what base image it pulls from, and that should determine the operating system under which the containers will run.



            Using the MySQL 8 Dockerfile as an example:



            https://github.com/docker-library/mysql/blob/223f0be1213bbd8647b841243a3114e8b34022f4/8.0/Dockerfile



            FROM debian:stretch-slim


            This means the image, and thus any containers started from it, will be based on Debian Linux...even if the host machine is MacOS.






            share|improve this answer





















            • I think you are technically wrong. There is linux docker and windows docker. (It is possible to run linux docker on windows or mac through virtual machine and this is in fact the most common way to run docker on windows.) However, windows docker images will not run on linux docker and vice-versa.
              – emory
              Nov 5 at 3:43











            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',
            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
            });


            }
            });






            Kaibin Lin is a new contributor. Be nice, and check out our Code of Conduct.










             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53147454%2fdoes-a-docker-image-build-on-macos-can-be-deployed-to-another-os-like-linux%23new-answer', 'question_page');
            }
            );

            Post as a guest
































            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            Docker on mac works by creating a linux virtual machine. So a docker image built on Mac is in fact built on a linux virtual machine and can be freely exchanged with most other docker systems - including most docker on windows.
            There is a windows version of dockers that is not linux based. Those images are not interchangeable.






            share|improve this answer

























              up vote
              1
              down vote













              Docker on mac works by creating a linux virtual machine. So a docker image built on Mac is in fact built on a linux virtual machine and can be freely exchanged with most other docker systems - including most docker on windows.
              There is a windows version of dockers that is not linux based. Those images are not interchangeable.






              share|improve this answer























                up vote
                1
                down vote










                up vote
                1
                down vote









                Docker on mac works by creating a linux virtual machine. So a docker image built on Mac is in fact built on a linux virtual machine and can be freely exchanged with most other docker systems - including most docker on windows.
                There is a windows version of dockers that is not linux based. Those images are not interchangeable.






                share|improve this answer












                Docker on mac works by creating a linux virtual machine. So a docker image built on Mac is in fact built on a linux virtual machine and can be freely exchanged with most other docker systems - including most docker on windows.
                There is a windows version of dockers that is not linux based. Those images are not interchangeable.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 5 at 3:46









                emory

                9,03812347




                9,03812347
























                    up vote
                    0
                    down vote













                    Docker images are platform agnostic. The first thing a Dockerfile declares is what base image it pulls from, and that should determine the operating system under which the containers will run.



                    Using the MySQL 8 Dockerfile as an example:



                    https://github.com/docker-library/mysql/blob/223f0be1213bbd8647b841243a3114e8b34022f4/8.0/Dockerfile



                    FROM debian:stretch-slim


                    This means the image, and thus any containers started from it, will be based on Debian Linux...even if the host machine is MacOS.






                    share|improve this answer





















                    • I think you are technically wrong. There is linux docker and windows docker. (It is possible to run linux docker on windows or mac through virtual machine and this is in fact the most common way to run docker on windows.) However, windows docker images will not run on linux docker and vice-versa.
                      – emory
                      Nov 5 at 3:43















                    up vote
                    0
                    down vote













                    Docker images are platform agnostic. The first thing a Dockerfile declares is what base image it pulls from, and that should determine the operating system under which the containers will run.



                    Using the MySQL 8 Dockerfile as an example:



                    https://github.com/docker-library/mysql/blob/223f0be1213bbd8647b841243a3114e8b34022f4/8.0/Dockerfile



                    FROM debian:stretch-slim


                    This means the image, and thus any containers started from it, will be based on Debian Linux...even if the host machine is MacOS.






                    share|improve this answer





















                    • I think you are technically wrong. There is linux docker and windows docker. (It is possible to run linux docker on windows or mac through virtual machine and this is in fact the most common way to run docker on windows.) However, windows docker images will not run on linux docker and vice-versa.
                      – emory
                      Nov 5 at 3:43













                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    Docker images are platform agnostic. The first thing a Dockerfile declares is what base image it pulls from, and that should determine the operating system under which the containers will run.



                    Using the MySQL 8 Dockerfile as an example:



                    https://github.com/docker-library/mysql/blob/223f0be1213bbd8647b841243a3114e8b34022f4/8.0/Dockerfile



                    FROM debian:stretch-slim


                    This means the image, and thus any containers started from it, will be based on Debian Linux...even if the host machine is MacOS.






                    share|improve this answer












                    Docker images are platform agnostic. The first thing a Dockerfile declares is what base image it pulls from, and that should determine the operating system under which the containers will run.



                    Using the MySQL 8 Dockerfile as an example:



                    https://github.com/docker-library/mysql/blob/223f0be1213bbd8647b841243a3114e8b34022f4/8.0/Dockerfile



                    FROM debian:stretch-slim


                    This means the image, and thus any containers started from it, will be based on Debian Linux...even if the host machine is MacOS.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 5 at 2:17









                    Mike

                    982516




                    982516












                    • I think you are technically wrong. There is linux docker and windows docker. (It is possible to run linux docker on windows or mac through virtual machine and this is in fact the most common way to run docker on windows.) However, windows docker images will not run on linux docker and vice-versa.
                      – emory
                      Nov 5 at 3:43


















                    • I think you are technically wrong. There is linux docker and windows docker. (It is possible to run linux docker on windows or mac through virtual machine and this is in fact the most common way to run docker on windows.) However, windows docker images will not run on linux docker and vice-versa.
                      – emory
                      Nov 5 at 3:43
















                    I think you are technically wrong. There is linux docker and windows docker. (It is possible to run linux docker on windows or mac through virtual machine and this is in fact the most common way to run docker on windows.) However, windows docker images will not run on linux docker and vice-versa.
                    – emory
                    Nov 5 at 3:43




                    I think you are technically wrong. There is linux docker and windows docker. (It is possible to run linux docker on windows or mac through virtual machine and this is in fact the most common way to run docker on windows.) However, windows docker images will not run on linux docker and vice-versa.
                    – emory
                    Nov 5 at 3:43










                    Kaibin Lin is a new contributor. Be nice, and check out our Code of Conduct.










                     

                    draft saved


                    draft discarded


















                    Kaibin Lin is a new contributor. Be nice, and check out our Code of Conduct.













                    Kaibin Lin is a new contributor. Be nice, and check out our Code of Conduct.












                    Kaibin Lin is a new contributor. Be nice, and check out our Code of Conduct.















                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53147454%2fdoes-a-docker-image-build-on-macos-can-be-deployed-to-another-os-like-linux%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest




















































































                    這個網誌中的熱門文章

                    Xamarin.form Move up view when keyboard appear

                    Post-Redirect-Get with Spring WebFlux and Thymeleaf

                    Anylogic : not able to use stopDelay()