mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #12573 from clnperez/doc-article-baseimage
Update doc with usage of the scratch image
This commit is contained in:
commit
7c64ed5c8c
1 changed files with 8 additions and 11 deletions
|
@ -41,22 +41,19 @@ GitHub Repo:
|
|||
- [Debian / Ubuntu](
|
||||
https://github.com/docker/docker/blob/master/contrib/mkimage-debootstrap.sh)
|
||||
|
||||
## Creating a simple base image using `scratch`
|
||||
## Creating a simple base image using scratch
|
||||
|
||||
There is a special repository in the Docker registry called `scratch`, which
|
||||
was created using an empty tar file:
|
||||
You can use Docker's reserved, minimal image, `scratch`, as a starting point for building containers. Using the `scratch` "image" signals to the build process that you want the next command in the `Dockerfile` to be the first filesystem layer in your image.
|
||||
|
||||
$ tar cv --files-from /dev/null | docker import - scratch
|
||||
|
||||
which you can `docker pull`. You can then use that
|
||||
image to base your new minimal containers `FROM`:
|
||||
While `scratch` appears in Docker's repository on the hub, you can't pull it, run it, or tag any image with the name `scratch`. Instead, you can refer to it in your `Dockerfile`. For example, to create a minimal container using `scratch`:
|
||||
|
||||
FROM scratch
|
||||
COPY true-asm /true
|
||||
CMD ["/true"]
|
||||
ADD hello /
|
||||
CMD ["/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)
|
||||
|
||||
The `Dockerfile` above is from an extremely minimal image - [tianon/true](
|
||||
https://github.com/tianon/dockerfiles/tree/master/true).
|
||||
|
||||
## More resources
|
||||
|
||||
|
|
Loading…
Reference in a new issue