Tools, FAQ, Tutorials:
Build "hello" Image from Alpine
How to Build my "hello" Docker image from the Alpine image? I want the container to print "Hello!" in the console.
✍: FYIcenter.com
If you want to build a new Docker image, you can try to build it with the Alpine image as its base as shown in this tutorial.
1. Create a "Dockerfile" file with 2 instructions:
fyicenter$ mkdir hello fyicenter$ cd hello fyicenter$ vi Dockerfile FROM alpine ENTRYPOINT echo Hello!
2. Build a new image named as "hello" using the Dockerfile in the current directory.
fyicenter$ docker build --tag hello . Sending build context to Docker daemon 4.608kB Step 1/2 : FROM alpine ---> 055936d39205 Step 2/2 : ENTRYPOINT echo Hello! ---> Running in 82250744f0a8 Removing intermediate container 82250744f0a8 ---> 2b2de59a503c Successfully built 2b2de59a503c Successfully tagged hello:latest
3. Create a new container from the image and run it.
fyicenter$ docker container run hello Hello!
4. Check the container.
fyicenter$ docker container list --latest CONTAINER ID IMAGE COMMAND CREATED STATUS e7507beb58a6 hello "/bin/sh -c 'echo He…" 5 seconds ago Exited (0) 5 seconds ago
5. Check the image.
fyicenter$ docker image list hello REPOSITORY TAG IMAGE ID CREATED SIZE hello latest 2b2de59a503c 10 seconds ago 5.53MB
As you can see, we have created a new Docker image, with "alpine" as the based and an updated starting command.
⇒ ENTRYPOINT [...] - Specify Entrypoint Executable
⇐ What Is "docker build" Command
2019-02-19, 1044🔥, 0💬
Popular Posts:
How to access Request body from "context.Request.Body" object in Azure API Policy? Request body is t...
What is EPUB 3.0 Metadata "dc:publisher" and "dc:rights" elements? EPUB 3.0 Metadata "dc:publisher" ...
How to use the "find-and-replace" Policy Statement for an Azure API service operation? The "find-and...
Where to find tutorials on Using Azure API Management Developer Portal? Here is a list of tutorials ...
How to start Docker Daemon, "dockerd", on CentOS systems? If you have installed Docker on your CentO...