From 984b8bdda6fb592fe67bde6525fd41d8a4d05867 Mon Sep 17 00:00:00 2001 From: Scott Fredericksen Date: Mon, 2 Jan 2017 04:10:37 -0700 Subject: [PATCH] Improved description for Hello-World Adds more detail for people to be able to understand how to build the Hello World using FROM scratch. --- engine/userguide/eng-image/baseimages.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/engine/userguide/eng-image/baseimages.md b/engine/userguide/eng-image/baseimages.md index 0de0c51040..35b31155e2 100644 --- a/engine/userguide/eng-image/baseimages.md +++ b/engine/userguide/eng-image/baseimages.md @@ -55,6 +55,17 @@ While `scratch` appears in Docker's repository on the hub, you can't pull it, ru ADD hello / CMD ["/hello"] +Assuming you built the "hello" executable example [from the Docker GitHub example C-source code](https://github.com/docker-library/hello-world/blob/master/hello.c), and you compiled it with the `-static` flag, you can then build this Docker image using: `docker build --tag hello .` + +NOTE: Because Docker for Mac and Dcoker for Windows use a Linux VM, you must compile this code using a Linux toolchain to end up with a Linux binary. Not to worry, you can quickly pull down a Linux image and a build environment and build within it: + + $ docker run --rm -it -v $PWD:/build ubuntu:16:04 + container# apt-get install build-essential + container# cd /build + container# gcc -o hello -static hello.c + +Then you can run it (on Linux, Mac, or Windows) using: `docker run hello` + This example creates the hello-world image used in the tutorials. If you want to test it out, you can clone [the image repo](https://github.com/docker-library/hello-world) @@ -66,4 +77,4 @@ There are lots more resources available to help you write your 'Dockerfile`. * There's a [complete guide to all the instructions](../../reference/builder.md) available for use in a `Dockerfile` in the reference section. * To help you write a clear, readable, maintainable `Dockerfile`, we've also written a [`Dockerfile` Best Practices guide](dockerfile_best-practices.md). -* If your goal is to create a new Official Repository, be sure to read up on Docker's [Official Repositories](/docker-hub/official_repos/). \ No newline at end of file +* If your goal is to create a new Official Repository, be sure to read up on Docker's [Official Repositories](/docker-hub/official_repos/).