{"id":454,"date":"2025-12-13T19:38:02","date_gmt":"2025-12-14T03:38:02","guid":{"rendered":"https:\/\/junsun.net\/wordpress\/?p=454"},"modified":"2025-12-13T19:38:02","modified_gmt":"2025-12-14T03:38:02","slug":"nuances-about-docker-io-on-ubuntu-24-04","status":"publish","type":"post","link":"https:\/\/junsun.net\/wordpress\/2025\/12\/nuances-about-docker-io-on-ubuntu-24-04\/","title":{"rendered":"Nuances about docker.io on Ubuntu 24.04"},"content":{"rendered":"\n<p>I just realized today that the default docker.io package from Ubuntu is seriously limited, compared with the one provided by Docker Inc with their docker-ce (community edition).<\/p>\n\n\n\n<p>For example, with the following Dockerfile, the Ubuntu&#8217;s version of docker would build all intermediate stages,  including test-stage, while with Docker Engine packages from docker-ce the test-stage will be skipped (which is more desirable).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># syntax=docker\/dockerfile:1\r\nFROM alpine:latest AS build-stage\r\nRUN echo \"Installing build tools...\"\r\nRUN mkdir \/app\r\nRUN touch \/app\/artifact.txt\r\n\r\nFROM alpine:latest AS test-stage\r\nRUN echo \"Running tests...\"\r\n# This stage is only run if explicitly targeted\r\n\r\nFROM alpine:latest AS production\r\nCOPY --from=build-stage \/app\/artifact.txt \/app\/artifact.txt\r\nCMD &#91;\"cat\", \"\/app\/artifact.txt\"]\n\r\n<\/code><\/pre>\n\n\n\n<p>To properly installed the docker.io and its companion packages, just follow <a href=\"https:\/\/docs.docker.com\/engine\/install\/ubuntu\/\">this page.<\/a>  The output for running the above Dockerfile will look like below with docker-ce packages.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>jsun@dev:~\/temp$ docker build . -t mytest\r\n&#91;+] Building 1.5s (11\/11) FINISHED                                                                                                                                                                                                             docker:default\r\n => &#91;internal] load build definition from Dockerfile                                                                                                                                                                                                     0.0s\r\n => => transferring dockerfile: 419B                                                                                                                                                                                                                     0.0s\r\n => resolve image config for docker-image:\/\/docker.io\/docker\/dockerfile:1                                                                                                                                                                                0.7s\r\n => CACHED docker-image:\/\/docker.io\/docker\/dockerfile:1@sha256:b6afd42430b15f2d2a4c5a02b919e98a525b785b1aaff16747d2f623364e39b6                                                                                                                          0.0s\r\n => => resolve docker.io\/docker\/dockerfile:1@sha256:b6afd42430b15f2d2a4c5a02b919e98a525b785b1aaff16747d2f623364e39b6                                                                                                                                     0.0s\r\n => &#91;internal] load metadata for docker.io\/library\/alpine:latest                                                                                                                                                                                         0.3s\r\n => &#91;internal] load .dockerignore                                                                                                                                                                                                                        0.0s\r\n => => transferring context: 2B                                                                                                                                                                                                                          0.0s\r\n => &#91;build-stage 1\/4] FROM docker.io\/library\/alpine:latest@sha256:51183f2cfa6320055da30872f211093f9ff1d3cf06f39a0bdb212314c5dc7375                                                                                                                       0.0s\r\n => => resolve docker.io\/library\/alpine:latest@sha256:51183f2cfa6320055da30872f211093f9ff1d3cf06f39a0bdb212314c5dc7375                                                                                                                                   0.0s\r\n => CACHED &#91;build-stage 2\/4] RUN echo \"Installing build tools...\"                                                                                                                                                                                        0.0s\r\n => CACHED &#91;build-stage 3\/4] RUN mkdir \/app                                                                                                                                                                                                              0.0s\r\n => CACHED &#91;build-stage 4\/4] RUN touch \/app\/artifact.txt                                                                                                                                                                                                 0.0s\r\n => CACHED &#91;production 2\/2] COPY --from=build-stage \/app\/artifact.txt \/app\/artifact.txt                                                                                                                                                                  0.0s\r\n => exporting to image                                                                                                                                                                                                                                   0.1s\r\n => => exporting layers                                                                                                                                                                                                                                  0.0s\r\n => => exporting manifest sha256:cfce1f88ad86e2d55be2ea639e9ccbee74e6feae06ff46d6a6f6efbe7b4e4f30                                                                                                                                                        0.0s\r\n => => exporting config sha256:f6db73b62eabd225c8916c02941c7389b510781cba6e8308c80036cde6a9d4f9                                                                                                                                                          0.0s\r\n => => exporting attestation manifest sha256:1b3ada3c9b1c771e50fbbb44962ee1baaaf659b635a66302d0c25b5fe484c86e                                                                                                                                            0.1s\r\n => => exporting manifest list sha256:44066fc8f168c1d0508e4ceca10171a3a1623deb7cbc813f97aeec5df4faa3c9                                                                                                                                                   0.0s\r\n => => naming to docker.io\/library\/mytest:latest                                                                                                                                                                                                         0.0s\r\n => => unpacking to docker.io\/library\/mytest:latest        <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I just realized today that the default docker.io package from Ubuntu is seriously limited, compared with the one provided by Docker Inc with their docker-ce (community edition). For example, with the following Dockerfile, the Ubuntu&#8217;s version of docker would build all intermediate stages, including test-stage, while with Docker Engine packages from docker-ce the test-stage will &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/junsun.net\/wordpress\/2025\/12\/nuances-about-docker-io-on-ubuntu-24-04\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Nuances about docker.io on Ubuntu 24.04&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[3],"tags":[102,16],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/posts\/454"}],"collection":[{"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/comments?post=454"}],"version-history":[{"count":2,"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/posts\/454\/revisions"}],"predecessor-version":[{"id":456,"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/posts\/454\/revisions\/456"}],"wp:attachment":[{"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/media?parent=454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/categories?post=454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/junsun.net\/wordpress\/wp-json\/wp\/v2\/tags?post=454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}