From a9e66ec72b55c7d2a854adca9670f8a336f95fc5 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 28 Sep 2021 10:41:24 -0400 Subject: [PATCH] Add man page for Containerfile and .containerignore Signed-off-by: Daniel J Walsh --- .gitignore | 1 + docs/Containerfile.5.md | 518 ++++++++++++++++++ docs/Makefile | 21 +- docs/{buildah-add.md => buildah-add.1.md} | 0 docs/{buildah-build.md => buildah-build.1.md} | 0 ...{buildah-commit.md => buildah-commit.1.md} | 0 ...{buildah-config.md => buildah-config.1.md} | 0 ...-containers.md => buildah-containers.1.md} | 0 docs/{buildah-copy.md => buildah-copy.1.md} | 0 docs/{buildah-from.md => buildah-from.1.md} | 0 ...{buildah-images.md => buildah-images.1.md} | 0 docs/{buildah-info.md => buildah-info.1.md} | 0 ...uildah-inspect.md => buildah-inspect.1.md} | 0 docs/{buildah-login.md => buildah-login.1.md} | 0 ...{buildah-logout.md => buildah-logout.1.md} | 0 ...ifest-add.md => buildah-manifest-add.1.md} | 0 ...tate.md => buildah-manifest-annotate.1.md} | 0 ...create.md => buildah-manifest-create.1.md} | 0 ...spect.md => buildah-manifest-inspect.1.md} | 0 ...est-push.md => buildah-manifest-push.1.md} | 0 ...remove.md => buildah-manifest-remove.1.md} | 0 ...anifest-rm.md => buildah-manifest-rm.1.md} | 0 ...ldah-manifest.md => buildah-manifest.1.md} | 18 +- docs/{buildah-mount.md => buildah-mount.1.md} | 0 docs/{buildah-pull.md => buildah-pull.1.md} | 0 docs/{buildah-push.md => buildah-push.1.md} | 0 ...{buildah-rename.md => buildah-rename.1.md} | 0 docs/{buildah-rm.md => buildah-rm.1.md} | 0 docs/{buildah-rmi.md => buildah-rmi.1.md} | 0 docs/{buildah-run.md => buildah-run.1.md} | 0 ...-source-add.md => buildah-source-add.1.md} | 0 ...e-create.md => buildah-source-create.1.md} | 0 ...ource-pull.md => buildah-source-pull.1.md} | 0 ...ource-push.md => buildah-source-push.1.md} | 0 docs/buildah-source.1.md | 31 ++ docs/buildah-source.md | 24 - docs/{buildah-tag.md => buildah-tag.1.md} | 0 ...{buildah-umount.md => buildah-umount.1.md} | 0 ...uildah-unshare.md => buildah-unshare.1.md} | 0 ...uildah-version.md => buildah-version.1.md} | 0 docs/{buildah.md => buildah.1.md} | 54 +- docs/containerignore.5.md | 87 +++ docs/links/.containerfile.5 | 1 + hack/xref-helpmsgs-manpages | 10 +- tests/validate/pr-should-include-tests | 1 + 45 files changed, 698 insertions(+), 68 deletions(-) create mode 100644 docs/Containerfile.5.md rename docs/{buildah-add.md => buildah-add.1.md} (100%) rename docs/{buildah-build.md => buildah-build.1.md} (100%) rename docs/{buildah-commit.md => buildah-commit.1.md} (100%) rename docs/{buildah-config.md => buildah-config.1.md} (100%) rename docs/{buildah-containers.md => buildah-containers.1.md} (100%) rename docs/{buildah-copy.md => buildah-copy.1.md} (100%) rename docs/{buildah-from.md => buildah-from.1.md} (100%) rename docs/{buildah-images.md => buildah-images.1.md} (100%) rename docs/{buildah-info.md => buildah-info.1.md} (100%) rename docs/{buildah-inspect.md => buildah-inspect.1.md} (100%) rename docs/{buildah-login.md => buildah-login.1.md} (100%) rename docs/{buildah-logout.md => buildah-logout.1.md} (100%) rename docs/{buildah-manifest-add.md => buildah-manifest-add.1.md} (100%) rename docs/{buildah-manifest-annotate.md => buildah-manifest-annotate.1.md} (100%) rename docs/{buildah-manifest-create.md => buildah-manifest-create.1.md} (100%) rename docs/{buildah-manifest-inspect.md => buildah-manifest-inspect.1.md} (100%) rename docs/{buildah-manifest-push.md => buildah-manifest-push.1.md} (100%) rename docs/{buildah-manifest-remove.md => buildah-manifest-remove.1.md} (100%) rename docs/{buildah-manifest-rm.md => buildah-manifest-rm.1.md} (100%) rename docs/{buildah-manifest.md => buildah-manifest.1.md} (54%) rename docs/{buildah-mount.md => buildah-mount.1.md} (100%) rename docs/{buildah-pull.md => buildah-pull.1.md} (100%) rename docs/{buildah-push.md => buildah-push.1.md} (100%) rename docs/{buildah-rename.md => buildah-rename.1.md} (100%) rename docs/{buildah-rm.md => buildah-rm.1.md} (100%) rename docs/{buildah-rmi.md => buildah-rmi.1.md} (100%) rename docs/{buildah-run.md => buildah-run.1.md} (100%) rename docs/{buildah-source-add.md => buildah-source-add.1.md} (100%) rename docs/{buildah-source-create.md => buildah-source-create.1.md} (100%) rename docs/{buildah-source-pull.md => buildah-source-pull.1.md} (100%) rename docs/{buildah-source-push.md => buildah-source-push.1.md} (100%) create mode 100644 docs/buildah-source.1.md delete mode 100644 docs/buildah-source.md rename docs/{buildah-tag.md => buildah-tag.1.md} (100%) rename docs/{buildah-umount.md => buildah-umount.1.md} (100%) rename docs/{buildah-unshare.md => buildah-unshare.1.md} (100%) rename docs/{buildah-version.md => buildah-version.1.md} (100%) rename docs/{buildah.md => buildah.1.md} (64%) create mode 100644 docs/containerignore.5.md create mode 100644 docs/links/.containerfile.5 diff --git a/.gitignore b/.gitignore index d98205316c..55bf4069c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ docs/buildah*.1 +docs/*.5 /bin /buildah /imgtype diff --git a/docs/Containerfile.5.md b/docs/Containerfile.5.md new file mode 100644 index 0000000000..42f784973c --- /dev/null +++ b/docs/Containerfile.5.md @@ -0,0 +1,518 @@ +% "CONTAINERFILE" "5" "Aug 2021" "" "Container User Manuals" + +# NAME + +Containerfile(Dockerfile) - automate the steps of creating a container image + +# INTRODUCTION + +The **Containerfile** is a configuration file that automates the steps of creating a container image. It is similar to a Makefile. Container engines (Podman, Buildah, Docker) read instructions from the **Containerfile** to automate the steps otherwise performed manually to create an image. To build an image, create a file called **Containerfile**. + +The **Containerfile** describes the steps taken to assemble the image. When the +**Containerfile** has been created, call the `buildah bud`, `podman build`, `docker build` command, +using the path of context directory that contains **Containerfile** as the argument. Podman and Buildah default to **Containerfile** and will fall back to **Dockerfile**. Docker only will search for **Dockerfile** in the context directory. + + +**Dockerfile** is an alternate name for the same object. **Containerfile** and **Dockerfile** support the same syntax. + +# SYNOPSIS + +INSTRUCTION arguments + +For example: + + FROM image + +# DESCRIPTION + +A Containerfile is a file that automates the steps of creating a container image. +A Containerfile is similar to a Makefile. + +# USAGE + + ``` + buildah bud . + podman build . + ``` + + -- Runs the steps and commits them, building a final image. + The path to the source repository defines where to find the context of the + build. + + ``` + buildah bud -t repository/tag . + podman build -t repository/tag . + ``` + + -- specifies a repository and tag at which to save the new image if the build + succeeds. The container engine runs the steps one-by-one, committing the result + to a new image if necessary, before finally outputting the ID of the new + image. + + Container engines re-use intermediate images whenever possible. This significantly + accelerates the *build* process. + +# FORMAT + + `FROM image` + + `FROM image:tag` + + `FROM image@digest` + + -- The **FROM** instruction sets the base image for subsequent instructions. A + valid Containerfile must have **FROM** as its first instruction. The image can be any + valid image. It is easy to start by pulling an image from the public + repositories. + + -- **FROM** must appear at least once in the Containerfile. + + -- **FROM** The first **FROM** command must come before all other instructions in + the Containerfile except **ARG** + + -- **FROM** may appear multiple times within a single Containerfile in order to create + multiple images. Make a note of the last image ID output by the commit before + each new **FROM** command. + + -- If no tag is given to the **FROM** instruction, container engines apply the + `latest` tag. If the used tag does not exist, an error is returned. + + -- If no digest is given to the **FROM** instruction, container engines apply the + `latest` tag. If the used tag does not exist, an error is returned. + +**MAINTAINER** + -- **MAINTAINER** sets the Author field for the generated images. + Useful for providing users with an email or url for support. + +**RUN** + -- **RUN** has two forms: + + ``` + # the command is run in a shell - /bin/sh -c + RUN + + # Executable form + RUN ["executable", "param1", "param2"] + ``` + +**RUN Secrets* + +The RUN command has a feature to allow the passing of secret information into the image build. These secrets files can be used during the RUN command but are not committed to the final image. The `RUN` command supports the `--mount` option to identify the secret file. A secret file from the host is mounted into the container while the image is being built. + +Container engines pass secret the secret file into the build using the `--secret` flag. + +**RUN --mount* options: + +- `id` is the identifier to for the secret passed into the `buildah bud --secret` or `podman build --secret`. This identifier is associated with the RUN --mount identifier to use in the Containerfile. + +- `dst`|`target`|`destination` rename the secret file to a specific file in the Containerfile RUN command to use. + +- `type=secret` tells the --mount command that it is mounting in a secret file + +``` +# shows secret from default secret location: +RUN --mount=type=secret,id=mysecret cat /run/secrets/mysecret +``` +``` +# shows secret from custom secret location: +RUN --mount=type=secret,id=mysecret,dst=/foobar cat /foobar +``` +The secret needs to be passed to the build using the --secret flag. The final image built does not container the secret file: + +``` + buildah bud --no-cache --secret id=mysecret,src=mysecret.txt . +``` + + -- The **RUN** instruction executes any commands in a new layer on top of the current + image and commits the results. The committed image is used for the next step in + Containerfile. + + -- Layering **RUN** instructions and generating commits conforms to the core + concepts of container engines where commits are cheap and containers can be created from + any point in the history of an image. This is similar to source control. The + exec form makes it possible to avoid shell string munging. The exec form makes + it possible to **RUN** commands using a base image that does not contain `/bin/sh`. + + Note that the exec form is parsed as a JSON array, which means that you must + use double-quotes (") around words not single-quotes ('). + +**CMD** + -- **CMD** has three forms: + + ``` + # Executable form + CMD ["executable", "param1", "param2"]` + + # Provide default arguments to ENTRYPOINT + CMD ["param1", "param2"]` + + # the command is run in a shell - /bin/sh -c + CMD command param1 param2 + ``` + + -- There should be only one **CMD** in a Containerfile. If more than one **CMD** is listed, only + the last **CMD** takes effect. + The main purpose of a **CMD** is to provide defaults for an executing container. + These defaults may include an executable, or they can omit the executable. If + they omit the executable, an **ENTRYPOINT** must be specified. + When used in the shell or exec formats, the **CMD** instruction sets the command to + be executed when running the image. + If you use the shell form of the **CMD**, the `` executes in `/bin/sh -c`: + + Note that the exec form is parsed as a JSON array, which means that you must + use double-quotes (") around words not single-quotes ('). + + ``` + FROM ubuntu + CMD echo "This is a test." | wc - + ``` + + -- If you run **command** without a shell, then you must express the command as a + JSON array and give the full path to the executable. This array form is the + preferred form of **CMD**. All additional parameters must be individually expressed + as strings in the array: + + ``` + FROM ubuntu + CMD ["/usr/bin/wc","--help"] + ``` + + -- To make the container run the same executable every time, use **ENTRYPOINT** in + combination with **CMD**. + If the user specifies arguments to `podman run` or `docker run`, the specified commands + override the default in **CMD**. + Do not confuse **RUN** with **CMD**. **RUN** runs a command and commits the result. + **CMD** executes nothing at build time, but specifies the intended command for + the image. + +**LABEL** + -- `LABEL = [= ...]`or + ``` + LABEL [ ] + LABEL [ ] + ... + ``` + The **LABEL** instruction adds metadata to an image. A **LABEL** is a + key-value pair. To specify a **LABEL** without a value, simply use an empty + string. To include spaces within a **LABEL** value, use quotes and + backslashes as you would in command-line parsing. + + ``` + LABEL com.example.vendor="ACME Incorporated" + LABEL com.example.vendor "ACME Incorporated" + LABEL com.example.vendor.is-beta "" + LABEL com.example.vendor.is-beta= + LABEL com.example.vendor.is-beta="" + ``` + + An image can have more than one label. To specify multiple labels, separate + each key-value pair by a space. + + Labels are additive including `LABEL`s in `FROM` images. As the system + encounters and then applies a new label, new `key`s override any previous + labels with identical keys. + + To display an image's labels, use the `buildah inspect` command. + +**EXPOSE** + -- `EXPOSE [...]` + The **EXPOSE** instruction informs the container engine that the container listens on the + specified network ports at runtime. The container engine uses this information to + interconnect containers using links and to set up port redirection on the host + system. + +**ENV** + -- `ENV ` + The **ENV** instruction sets the environment variable to + the value ``. This value is passed to all future + **RUN**, **ENTRYPOINT**, and **CMD** instructions. This is + functionally equivalent to prefixing the command with `=`. The + environment variables that are set with **ENV** persist when a container is run + from the resulting image. Use `podman inspect` to inspect these values, and + change them using `podman run --env =`. + + Note that setting "`ENV DEBIAN_FRONTEND=noninteractive`" may cause + unintended consequences, because it will persist when the container is run + interactively, as with the following command: `podman run -t -i image bash` + +**ADD** + -- **ADD** has two forms: + + ``` + ADD + + # Required for paths with whitespace + ADD ["",... ""] + ``` + + The **ADD** instruction copies new files, directories + or remote file URLs to the filesystem of the container at path ``. + Multiple `` resources may be specified but if they are files or directories + then they must be relative to the source directory that is being built + (the context of the build). The `` is the absolute path, or path relative + to **WORKDIR**, into which the source is copied inside the target container. + If the `` argument is a local file in a recognized compression format + (tar, gzip, bzip2, etc) then it is unpacked at the specified `` in the + container's filesystem. Note that only local compressed files will be unpacked, + i.e., the URL download and archive unpacking features cannot be used together. + All new directories are created with mode 0755 and with the uid and gid of **0**. + +**COPY** + -- **COPY** has two forms: + + ``` + COPY + + # Required for paths with whitespace + COPY ["",... ""] + ``` + + The **COPY** instruction copies new files from `` and + adds them to the filesystem of the container at path . The `` must be + the path to a file or directory relative to the source directory that is + being built (the context of the build) or a remote file URL. The `` is an + absolute path, or a path relative to **WORKDIR**, into which the source will + be copied inside the target container. If you **COPY** an archive file it will + land in the container exactly as it appears in the build context without any + attempt to unpack it. All new files and directories are created with mode **0755** + and with the uid and gid of **0**. + +**ENTRYPOINT** + -- **ENTRYPOINT** has two forms: + + ``` + # executable form + ENTRYPOINT ["executable", "param1", "param2"]` + + # run command in a shell - /bin/sh -c + ENTRYPOINT command param1 param2 + ``` + + -- An **ENTRYPOINT** helps you configure a + container that can be run as an executable. When you specify an **ENTRYPOINT**, + the whole container runs as if it was only that executable. The **ENTRYPOINT** + instruction adds an entry command that is not overwritten when arguments are + passed to `podman run`. This is different from the behavior of **CMD**. This allows + arguments to be passed to the entrypoint, for instance `podman run -d` + passes the -d argument to the **ENTRYPOINT**. Specify parameters either in the + **ENTRYPOINT** JSON array (as in the preferred exec form above), or by using a **CMD** + statement. Parameters in the **ENTRYPOINT** are not overwritten by the `podman run` arguments. Parameters specified via **CMD** are overwritten by `podman run` arguments. Specify a plain string for the **ENTRYPOINT**, and it will execute in + `/bin/sh -c`, like a **CMD** instruction: + + ``` + FROM ubuntu + ENTRYPOINT wc -l - + ``` + + This means that the Containerfile's image always takes stdin as input (that's + what "-" means), and prints the number of lines (that's what "-l" means). To + make this optional but default, use a **CMD**: + + ``` + FROM ubuntu + CMD ["-l", "-"] + ENTRYPOINT ["/usr/bin/wc"] + ``` + +**VOLUME** + -- `VOLUME ["/data"]` + The **VOLUME** instruction creates a mount point with the specified name and marks + it as holding externally-mounted volumes from the native host or from other + containers. + +**USER** + -- `USER daemon` + Sets the username or UID used for running subsequent commands. + + The **USER** instruction can optionally be used to set the group or GID. The + following examples are all valid: + USER [user | user:group | uid | uid:gid | user:gid | uid:group ] + + Until the **USER** instruction is set, instructions will be run as root. The USER + instruction can be used any number of times in a Containerfile, and will only affect + subsequent commands. + +**WORKDIR** + -- `WORKDIR /path/to/workdir` + The **WORKDIR** instruction sets the working directory for the **RUN**, **CMD**, + **ENTRYPOINT**, **COPY** and **ADD** Containerfile commands that follow it. It can + be used multiple times in a single Containerfile. Relative paths are defined + relative to the path of the previous **WORKDIR** instruction. For example: + + ``` + WORKDIR /a + WORKDIR b + WORKDIR c + RUN pwd + ``` + + In the above example, the output of the **pwd** command is **a/b/c**. + +**ARG** + -- ARG [=] + + The `ARG` instruction defines a variable that users can pass at build-time to + the builder with the `podman build` and `buildah build` commands using the + `--build-arg =` flag. If a user specifies a build argument that + was not defined in the Containerfile, the build outputs a warning. + + Note that a second FROM in a Containerfile sets the values associated with an + Arg variable to nil and they must be reset if they are to be used later in + the Containerfile + +``` + [Warning] One or more build-args [foo] were not consumed + ``` + + The Containerfile author can define a single variable by specifying `ARG` once or many + variables by specifying `ARG` more than once. For example, a valid Containerfile: + + ``` + FROM busybox + ARG user1 + ARG buildno + ... + ``` + + A Containerfile author may optionally specify a default value for an `ARG` instruction: + + ``` + FROM busybox + ARG user1=someuser + ARG buildno=1 + ... + ``` + + If an `ARG` value has a default and if there is no value passed at build-time, the + builder uses the default. + + An `ARG` variable definition comes into effect from the line on which it is + defined in the `Containerfile` not from the argument's use on the command-line or + elsewhere. For example, consider this Containerfile: + + ``` + 1 FROM busybox + 2 USER ${user:-some_user} + 3 ARG user + 4 USER $user + ... + ``` + A user builds this file by calling: + + ``` + $ podman build --build-arg user=what_user Containerfile + ``` + + The `USER` at line 2 evaluates to `some_user` as the `user` variable is defined on the + subsequent line 3. The `USER` at line 4 evaluates to `what_user` as `user` is + defined and the `what_user` value was passed on the command line. Prior to its definition by an + `ARG` instruction, any use of a variable results in an empty string. + + > **Warning:** It is not recommended to use build-time variables for + > passing secrets like github keys, user credentials etc. Build-time variable + > values are visible to any user of the image with the `podman history` command. + + You can use an `ARG` or an `ENV` instruction to specify variables that are + available to the `RUN` instruction. Environment variables defined using the + `ENV` instruction always override an `ARG` instruction of the same name. Consider + this Containerfile with an `ENV` and `ARG` instruction. + + ``` + 1 FROM ubuntu + 2 ARG CONT_IMG_VER + 3 ENV CONT_IMG_VER=v1.0.0 + 4 RUN echo $CONT_IMG_VER + ``` + Then, assume this image is built with this command: + + ``` + $ podman build --build-arg CONT_IMG_VER=v2.0.1 Containerfile + ``` + + In this case, the `RUN` instruction uses `v1.0.0` instead of the `ARG` setting + passed by the user:`v2.0.1` This behavior is similar to a shell + script where a locally scoped variable overrides the variables passed as + arguments or inherited from environment, from its point of definition. + + Using the example above but a different `ENV` specification you can create more + useful interactions between `ARG` and `ENV` instructions: + + ``` + 1 FROM ubuntu + 2 ARG CONT_IMG_VER + 3 ENV CONT_IMG_VER=${CONT_IMG_VER:-v1.0.0} + 4 RUN echo $CONT_IMG_VER + ``` + + Unlike an `ARG` instruction, `ENV` values are always persisted in the built + image. Consider a `podman build` without the --build-arg flag: + + ``` + $ podman build Containerfile + ``` + + Using this Containerfile example, `CONT_IMG_VER` is still persisted in the image but + its value would be `v1.0.0` as it is the default set in line 3 by the `ENV` instruction. + + The variable expansion technique in this example allows you to pass arguments + from the command line and persist them in the final image by leveraging the + `ENV` instruction. Variable expansion is only supported for [a limited set of + Containerfile instructions.](#environment-replacement) + + Container engines have a set of predefined `ARG` variables that you can use without a + corresponding `ARG` instruction in the Containerfile. + + * `HTTP_PROXY` + * `http_proxy` + * `HTTPS_PROXY` + * `https_proxy` + * `FTP_PROXY` + * `ftp_proxy` + * `NO_PROXY` + * `no_proxy` + * `ALL_PROXY` + * `all_proxy` + + To use these, pass them on the command line using `--build-arg` flag, for + example: + + ``` + $ podman build --build-arg HTTPS_PROXY=https://my-proxy.example.com . + ``` + +**ONBUILD** + -- `ONBUILD [INSTRUCTION]` + The **ONBUILD** instruction adds a trigger instruction to an image. The + trigger is executed at a later time, when the image is used as the base for + another build. Container engines execute the trigger in the context of the downstream + build, as if the trigger existed immediately after the **FROM** instruction in + the downstream Containerfile. + + You can register any build instruction as a trigger. A trigger is useful if + you are defining an image to use as a base for building other images. For + example, if you are defining an application build environment or a daemon that + is customized with a user-specific configuration. + + Consider an image intended as a reusable python application builder. It must + add application source code to a particular directory, and might need a build + script called after that. You can't just call **ADD** and **RUN** now, because + you don't yet have access to the application source code, and it is different + for each application build. + + -- Providing application developers with a boilerplate Containerfile to copy-paste + into their application is inefficient, error-prone, and + difficult to update because it mixes with application-specific code. + The solution is to use **ONBUILD** to register instructions in advance, to + run later, during the next build stage. + +## SEE ALSO +buildah(1), podman(1), docker(1) + +# HISTORY +``` +May 2014, Compiled by Zac Dover (zdover at redhat dot com) based on docker.com Dockerfile documentation. +Feb 2015, updated by Brian Goff (cpuguy83@gmail.com) for readability +Sept 2015, updated by Sally O'Malley (somalley@redhat.com) +Oct 2016, updated by Addam Hardy (addam.hardy@gmail.com) +Aug 2021, converted Dockerfile man page to Containerfile by Dan Walsh (dwalsh@redhat.com) +``` diff --git a/docs/Makefile b/docs/Makefile index 8fa61994c5..f063310c94 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,19 +1,34 @@ PREFIX := /usr/local DATADIR := ${PREFIX}/share MANDIR := $(DATADIR)/man -GOMD2MAN ?= ../tests/tools/build/go-md2man +GOMD2MAN ?= $(shell command -v go-md2man || echo '$(GOBIN)/go-md2man') -docs: $(patsubst %.md,%.1,$(wildcard *.md)) +docs: $(patsubst %.md,%,$(wildcard *.md)) -%.1: %.md +%.5: %.5.md $(GOMD2MAN) -in $^ -out $@ +%.1: %.1.md +### sed is used to filter http/s links as well as relative links +### replaces "\" at the end of a line with two spaces +### this ensures that manpages are renderd correctly + + @sed -e 's/\((buildah[^)]*\.md\(#.*\)\?)\)//g' \ + -e 's/\[\(buildah[^]]*\)\]/\1/g' \ + -e 's/\[\([^]]*\)](http[^)]\+)/\1/g' \ + -e 's;<\(/\)\?\(a\|a\s\+[^>]*\|sup\)>;;g' \ + -e 's/\\$$/ /g' $< | \ + $(GOMD2MAN) -in /dev/stdin -out $@ + .PHONY: install install: install -d ${DESTDIR}/${MANDIR}/man1 install -m 0644 buildah*.1 ${DESTDIR}/${MANDIR}/man1 install -m 0644 links/buildah*.1 ${DESTDIR}/${MANDIR}/man1 + install -d ${DESTDIR}/${MANDIR}/man5 + install -m 0644 *.5 ${DESTDIR}/${MANDIR}/man5 .PHONY: clean clean: $(RM) buildah*.1 + $(RM) *.5 diff --git a/docs/buildah-add.md b/docs/buildah-add.1.md similarity index 100% rename from docs/buildah-add.md rename to docs/buildah-add.1.md diff --git a/docs/buildah-build.md b/docs/buildah-build.1.md similarity index 100% rename from docs/buildah-build.md rename to docs/buildah-build.1.md diff --git a/docs/buildah-commit.md b/docs/buildah-commit.1.md similarity index 100% rename from docs/buildah-commit.md rename to docs/buildah-commit.1.md diff --git a/docs/buildah-config.md b/docs/buildah-config.1.md similarity index 100% rename from docs/buildah-config.md rename to docs/buildah-config.1.md diff --git a/docs/buildah-containers.md b/docs/buildah-containers.1.md similarity index 100% rename from docs/buildah-containers.md rename to docs/buildah-containers.1.md diff --git a/docs/buildah-copy.md b/docs/buildah-copy.1.md similarity index 100% rename from docs/buildah-copy.md rename to docs/buildah-copy.1.md diff --git a/docs/buildah-from.md b/docs/buildah-from.1.md similarity index 100% rename from docs/buildah-from.md rename to docs/buildah-from.1.md diff --git a/docs/buildah-images.md b/docs/buildah-images.1.md similarity index 100% rename from docs/buildah-images.md rename to docs/buildah-images.1.md diff --git a/docs/buildah-info.md b/docs/buildah-info.1.md similarity index 100% rename from docs/buildah-info.md rename to docs/buildah-info.1.md diff --git a/docs/buildah-inspect.md b/docs/buildah-inspect.1.md similarity index 100% rename from docs/buildah-inspect.md rename to docs/buildah-inspect.1.md diff --git a/docs/buildah-login.md b/docs/buildah-login.1.md similarity index 100% rename from docs/buildah-login.md rename to docs/buildah-login.1.md diff --git a/docs/buildah-logout.md b/docs/buildah-logout.1.md similarity index 100% rename from docs/buildah-logout.md rename to docs/buildah-logout.1.md diff --git a/docs/buildah-manifest-add.md b/docs/buildah-manifest-add.1.md similarity index 100% rename from docs/buildah-manifest-add.md rename to docs/buildah-manifest-add.1.md diff --git a/docs/buildah-manifest-annotate.md b/docs/buildah-manifest-annotate.1.md similarity index 100% rename from docs/buildah-manifest-annotate.md rename to docs/buildah-manifest-annotate.1.md diff --git a/docs/buildah-manifest-create.md b/docs/buildah-manifest-create.1.md similarity index 100% rename from docs/buildah-manifest-create.md rename to docs/buildah-manifest-create.1.md diff --git a/docs/buildah-manifest-inspect.md b/docs/buildah-manifest-inspect.1.md similarity index 100% rename from docs/buildah-manifest-inspect.md rename to docs/buildah-manifest-inspect.1.md diff --git a/docs/buildah-manifest-push.md b/docs/buildah-manifest-push.1.md similarity index 100% rename from docs/buildah-manifest-push.md rename to docs/buildah-manifest-push.1.md diff --git a/docs/buildah-manifest-remove.md b/docs/buildah-manifest-remove.1.md similarity index 100% rename from docs/buildah-manifest-remove.md rename to docs/buildah-manifest-remove.1.md diff --git a/docs/buildah-manifest-rm.md b/docs/buildah-manifest-rm.1.md similarity index 100% rename from docs/buildah-manifest-rm.md rename to docs/buildah-manifest-rm.1.md diff --git a/docs/buildah-manifest.md b/docs/buildah-manifest.1.md similarity index 54% rename from docs/buildah-manifest.md rename to docs/buildah-manifest.1.md index db70ed4d16..fade5f260d 100644 --- a/docs/buildah-manifest.md +++ b/docs/buildah-manifest.1.md @@ -17,15 +17,15 @@ The `buildah manifest` command provides subcommands which can be used to: ## SUBCOMMANDS -| Command | Man Page | Description | -| ------- | ------------------------------------------------------------ | --------------------------------------------------------------------------- | -| add | [buildah-manifest-add(1)](buildah-manifest-add.md) | Add an image to a manifest list or image index. | -| annotate | [buildah-manifest-annotate(1)](buildah-manifest-annotate.md) | Add or update information about an image in a manifest list or image index. | -| create | [buildah-manifest-create(1)](buildah-manifest-create.md) | Create a manifest list or image index. | -| inspect | [buildah-manifest-inspect(1)](buildah-manifest-inspect.md) | Display the contents of a manifest list or image index. | -| push | [buildah-manifest-push(1)](buildah-manifest-push.md) | Push a manifest list or image index to a registry or other location. | -| remove | [buildah-manifest-remove(1)](buildah-manifest-remove.md) | Remove an image from a manifest list or image index. | -| rm | [buildah-manifest-rm(1)](buildah-manifest-rm.md) | Remove manifest list from local storage. | +| Command | Man Page | Description | +| ------- | -------------------------------------------------------------- | --------------------------------------------------------------------------- | +| add | [buildah-manifest-add(1)](buildah-manifest-add.1.md) | Add an image to a manifest list or image index. | +| annotate | [buildah-manifest-annotate(1)](buildah-manifest-annotate.1.md) | Add or update information about an image in a manifest list or image index. | +| create | [buildah-manifest-create(1)](buildah-manifest-create.1.md) | Create a manifest list or image index. | +| inspect | [buildah-manifest-inspect(1)](buildah-manifest-inspect.1.md) | Display the contents of a manifest list or image index. | +| push | [buildah-manifest-push(1)](buildah-manifest-push.1.md) | Push a manifest list or image index to a registry or other location. | +| remove | [buildah-manifest-remove(1)](buildah-manifest-remove.1.md) | Remove an image from a manifest list or image index. | +| rm | [buildah-manifest-rm(1)](buildah-manifest-rm.1.md) | Remove manifest list from local storage. | ## SEE ALSO buildah(1), buildah-manifest-create(1), buildah-manifest-add(1), buildah-manifest-remove(1), buildah-manifest-annotate(1), buildah-manifest-inspect(1), buildah-manifest-push(1), buildah-manifest-rm(1) diff --git a/docs/buildah-mount.md b/docs/buildah-mount.1.md similarity index 100% rename from docs/buildah-mount.md rename to docs/buildah-mount.1.md diff --git a/docs/buildah-pull.md b/docs/buildah-pull.1.md similarity index 100% rename from docs/buildah-pull.md rename to docs/buildah-pull.1.md diff --git a/docs/buildah-push.md b/docs/buildah-push.1.md similarity index 100% rename from docs/buildah-push.md rename to docs/buildah-push.1.md diff --git a/docs/buildah-rename.md b/docs/buildah-rename.1.md similarity index 100% rename from docs/buildah-rename.md rename to docs/buildah-rename.1.md diff --git a/docs/buildah-rm.md b/docs/buildah-rm.1.md similarity index 100% rename from docs/buildah-rm.md rename to docs/buildah-rm.1.md diff --git a/docs/buildah-rmi.md b/docs/buildah-rmi.1.md similarity index 100% rename from docs/buildah-rmi.md rename to docs/buildah-rmi.1.md diff --git a/docs/buildah-run.md b/docs/buildah-run.1.md similarity index 100% rename from docs/buildah-run.md rename to docs/buildah-run.1.md diff --git a/docs/buildah-source-add.md b/docs/buildah-source-add.1.md similarity index 100% rename from docs/buildah-source-add.md rename to docs/buildah-source-add.1.md diff --git a/docs/buildah-source-create.md b/docs/buildah-source-create.1.md similarity index 100% rename from docs/buildah-source-create.md rename to docs/buildah-source-create.1.md diff --git a/docs/buildah-source-pull.md b/docs/buildah-source-pull.1.md similarity index 100% rename from docs/buildah-source-pull.md rename to docs/buildah-source-pull.1.md diff --git a/docs/buildah-source-push.md b/docs/buildah-source-push.1.md similarity index 100% rename from docs/buildah-source-push.md rename to docs/buildah-source-push.1.md diff --git a/docs/buildah-source.1.md b/docs/buildah-source.1.md new file mode 100644 index 0000000000..6fa5ff2d69 --- /dev/null +++ b/docs/buildah-source.1.md @@ -0,0 +1,31 @@ +# buildah-source "1" "March 2021" "buildah" + +## NAME +buildah\-source - Create, push, pull and manage source images and associated source artifacts + +## SYNOPSIS +**buildah source** *subcommand* + +## DESCRIPTION +Create, push, pull and manage source images and associated source artifacts. A +source image contains all source artifacts an ordinary OCI image has been built +with. Those artifacts can be any kind of source artifact, such as source RPMs, +an entire source tree or text files. + +Note that the buildah-source command and all its subcommands are experimental +and may be subject to future changes. + +## COMMANDS + +| Command | Man Page | Description | +| -------- | ------------------------------------------------------ | ---------------------------------------------------------- | +| add | [buildah-source-add(1)](buildah-source-add.1.md) | Add a source artifact to a source image. | +| create | [buildah-source-create(1)](buildah-source-create.1.md) | Create and initialize a source image. | +| pull | [buildah-source-pull(1)](buildah-source-pull.1.md) | Pull a source image from a registry to a specified path. | +| push | [buildah-source-push(1)](buildah-source-push.1.md) | Push a source image from a specified path to a registry. | + +## SEE ALSO +buildah(1) + +## HISTORY +June 2021, Originally compiled by Valentin Rothberg diff --git a/docs/buildah-source.md b/docs/buildah-source.md deleted file mode 100644 index 5300a4e977..0000000000 --- a/docs/buildah-source.md +++ /dev/null @@ -1,24 +0,0 @@ -# buildah-source "1" "March 2021" "buildah" - -## NAME -buildah\-source - Create, push, pull and manage source images and associated source artifacts - -## SYNOPSIS -**buildah source** *subcommand* - -## DESCRIPTION -Create, push, pull and manage source images and associated source artifacts. A -source image contains all source artifacts an ordinary OCI image has been built -with. Those artifacts can be any kind of source artifact, such as source RPMs, -an entire source tree or text files. - -Note that the buildah-source command and all its subcommands are experimental -and may be subject to future changes. - -## COMMANDS -| Command | Man Page | Description | -| -------- | ---------------------------------------------------- | ---------------------------------------------------------- | -| add | [buildah-source-add(1)](buildah-source-add.md) | Add a source artifact to a source image. | -| create | [buildah-source-create(1)](buildah-source-create.md) | Create and initialize a source image. | -| pull | [buildah-source-pull(1)](buildah-source-pull.md) | Pull a source image from a registry to a specified path. | -| push | [buildah-source-push(1)](buildah-source-push.md) | Push a source image from a specified path to a registry. | diff --git a/docs/buildah-tag.md b/docs/buildah-tag.1.md similarity index 100% rename from docs/buildah-tag.md rename to docs/buildah-tag.1.md diff --git a/docs/buildah-umount.md b/docs/buildah-umount.1.md similarity index 100% rename from docs/buildah-umount.md rename to docs/buildah-umount.1.md diff --git a/docs/buildah-unshare.md b/docs/buildah-unshare.1.md similarity index 100% rename from docs/buildah-unshare.md rename to docs/buildah-unshare.1.md diff --git a/docs/buildah-version.md b/docs/buildah-version.1.md similarity index 100% rename from docs/buildah-version.md rename to docs/buildah-version.1.md diff --git a/docs/buildah.md b/docs/buildah.1.md similarity index 64% rename from docs/buildah.md rename to docs/buildah.1.md index b8f0fbe2a8..6e1af49835 100644 --- a/docs/buildah.md +++ b/docs/buildah.1.md @@ -136,33 +136,33 @@ Buildah can set up environment variables from the env entry in the [engine] tabl ## COMMANDS -| Command | Description | -| --------------------- | --------------------------------------------------- | -| buildah-add(1) | Add the contents of a file, URL, or a directory to the container. | -| buildah-build(1) | Build an image using instructions from Dockerfiles. | -| buildah-commit(1) | Create an image from a working container. | -| buildah-config(1) | Update image configuration settings. | -| buildah-containers(1) | List the working containers and their base images. | -| buildah-copy(1) | Copies the contents of a file, URL, or directory into a container's working directory. | -| buildah-from(1) | Creates a new working container, either from scratch or using a specified image as a starting point. | -| buildah-images(1) | List images in local storage. | -| buildah-info(1) | Display Buildah system information. | -| buildah-inspect(1) | Inspects the configuration of a container or image | -| buildah-login(1) | Login to a container registry. | -| buildah-logout(1) | Logout of a container registry | -| buildah-manifest(1) | Create and manipulate manifest lists and image indexes. | -| buildah-mount(1) | Mount the working container's root filesystem. | -| buildah-pull(1) | Pull an image from the specified location. | -| buildah-push(1) | Push an image from local storage to elsewhere. | -| buildah-rename(1) | Rename a local container. | -| buildah-rm(1) | Removes one or more working containers. | -| buildah-rmi(1) | Removes one or more images. | -| buildah-run(1) | Run a command inside of the container. | -| buildah-source(1) | Create, push, pull and manage source images and associated source artifacts. | -| buildah-tag(1) | Add an additional name to a local image. | -| buildah-umount(1) | Unmount a working container's root file system. | -| buildah-unshare(1) | Launch a command in a user namespace with modified ID mappings. | -| buildah-version(1) | Display the Buildah Version Information | +| Command | Man Page | Description | +| ---------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------- | +| add | [buildah-add(1)](buildah-add.1.md) | Add the contents of a file, URL, or a directory to the container. | +| build | [buildah-build(1)](buildah-build.1.md) | Build an image using instructions from Dockerfiles. | +| commit | [buildah-commit(1)](buildah-commit.1.md) | Create an image from a working container. | +| config | [buildah-config(1)](buildah-config.1.md) | Update image configuration settings. | +| containers | [buildah-containers(1)](buildah-containers.1.md) | List the working containers and their base images. | +| copy | [buildah-copy(1)](buildah-copy.1.md) | Copies the contents of a file, URL, or directory into a container's working directory. | +| from | [buildah-from(1)](buildah-from.1.md) | Creates a new working container, either from scratch or using a specified image as a starting point. | +| images | [buildah-images(1)](buildah-images.1.md) | List images in local storage. | +| info | [buildah-info(1)](buildah-info.1.md) | Display Buildah system information. | +| inspect | [buildah-inspect(1)](buildah-inspect.1.md) | Inspects the configuration of a container or image | +| login | [buildah-login(1)](buildah-login.1.md) | Login to a container registry. | +| logout | [buildah-logout(1)](buildah-logout.1.md) | Logout of a container registry | +| manifest | [buildah-manifest(1)](buildah-manifest.1.md) | Create and manipulate manifest lists and image indexes. | +| mount | [buildah-mount(1)](buildah-mount.1.md) | Mount the working container's root filesystem. | +| pull | [buildah-pull(1)](buildah-pull.1.md) | Pull an image from the specified location. | +| push | [buildah-push(1)](buildah-push.1.md) | Push an image from local storage to elsewhere. | +| rename | [buildah-rename(1)](buildah-rename.1.md) | Rename a local container. | +| rm | [buildah-rm(1)](buildah-rm.1.md) | Removes one or more working containers. | +| rmi | [buildah-rmi(1)](buildah-rmi.1.md) | Removes one or more images. | +| run | [buildah-run(1)](buildah-run.1.md) | Run a command inside of the container. | +| source | [buildah-source(1)](buildah-source.1.md) | Create, push, pull and manage source images and associated source artifacts. | +| tag | [buildah-tag(1)](buildah-tag.1.md) | Add an additional name to a local image. | +| umount | [buildah-umount(1)](buildah-umount.1.md) | Unmount a working container's root file system. | +| unshare | [buildah-unshare(1)](buildah-unshare.1.md) | Launch a command in a user namespace with modified ID mappings. | +| version | [buildah-version(1)](buildah-version.1.md) | Display the Buildah Version Information | ## Files diff --git a/docs/containerignore.5.md b/docs/containerignore.5.md new file mode 100644 index 0000000000..a3edc0c27d --- /dev/null +++ b/docs/containerignore.5.md @@ -0,0 +1,87 @@ +% ".containerignore" "28" "Sep 2021" "" "Container User Manuals" + +# NAME + +.containerignore(.dockerignore) - files to ignore buildah or podman build context directory + +# INTRODUCTION + +Before container engines build image, they look for a file named .containerignore or .dockerignore in the root +context directory. If one of these file exists, the CLI modifies the context to exclude files and +directories that match patterns specified in the file. This avoids adding them to images using the ADD or COPY +instruction. + +The CLI interprets the .containerignore or .dockerignore file as a newline-separated list of patterns similar to +the file globs of Unix shells. For the purposes of matching, the root of the context is considered to be both the +working and the root directory. For example, the patterns /foo/bar and foo/bar both exclude a file or directory +named bar in the foo subdirectory of PATH or in the root of the git repository located at URL. Neither excludes +anything else. + +If a line in .containerignore or .dockerignore file starts with # in column 1, then this line is considered as a +comment and is ignored before interpreted by the CLI. + +# EXAMPLES + +Here is an example .containerignore file: + +``` +# comment +*/temp* +*/*/temp* +temp? +``` + +This file causes the following build behavior: +Rule Behavior +``` +# comment Ignored. +*/temp* Exclude files and directories whose names start with temp in any immediate subdirectory of the root. +For example, the plain file /somedir/temporary.txt is excluded, as is the directory /somedir/temp. +*/*/temp* Exclude files and directories starting with temp from any subdirectory that is two levels below the +root. For example, /somedir/subdir/temporary.txt is excluded. +temp? Exclude files and directories in the root directory whose names are a one-character extension of temp. For example, /tempa and /tempb are excluded. +``` +Matching is done using Go’s filepath.Match rules. A preprocessing step removes leading and trailing whitespace and +eliminates . and .. elements using Go’s filepath.Clean. Lines that are blank after preprocessing are ignored. + +Beyond Go’s filepath.Match rules, Docker also supports a special wildcard string ** that matches any number of +directories (including zero). For example, **/*.go will exclude all files that end with .go that are found in all +directories, including the root of the build context. + +Lines starting with ! (exclamation mark) can be used to make exceptions to exclusions. The following is an example .containerignore file that uses this mechanism: +``` +*.md +!README.md +``` +All markdown files except README.md are excluded from the context. + +The placement of ! exception rules influences the behavior: the last line of the .containerignore that matches a +particular file determines whether it is included or excluded. Consider the following example: +``` +*.md +!README*.md +README-secret.md +``` +No markdown files are included in the context except README files other than README-secret.md. + +Now consider this example: +``` +*.md +README-secret.md +!README*.md +``` +All of the README files are included. The middle line has no effect because !README*.md matches README-secret.md and +comes last. + +You can even use the .containerignore file to exclude the Containerfile or Dockerfile and .containerignore files. +These files are still sent to the daemon because it needs them to do its job. But the ADD and COPY instructions do +not copy them to the image. + +Finally, you may want to specify which files to include in the context, rather than which to exclude. To achieve +this, specify * as the first pattern, followed by one or more ! exception patterns. + +## SEE ALSO +buildah-build(1), podman-build(1), docker-build(1) + +# HISTORY +*Sep 2021, Compiled by Dan Walsh (dwalsh at redhat dot com) based on docker.com .dockerignore documentation. diff --git a/docs/links/.containerfile.5 b/docs/links/.containerfile.5 new file mode 100644 index 0000000000..f6a63343d5 --- /dev/null +++ b/docs/links/.containerfile.5 @@ -0,0 +1 @@ +.so man5/containerfile.5 diff --git a/hack/xref-helpmsgs-manpages b/hack/xref-helpmsgs-manpages index aed7351ea6..6543de8cb9 100755 --- a/hack/xref-helpmsgs-manpages +++ b/hack/xref-helpmsgs-manpages @@ -229,11 +229,11 @@ sub tool_help { ############## -# tool_man # Parse contents of -*.md +# tool_man # Parse contents of -*.1.md ############## sub tool_man { my $command = shift; - my $subpath = "$Markdown_Path/$command.md"; + my $subpath = "$Markdown_Path/$command.1.md"; my $manpath = "$FindBin::Bin/../$subpath"; print "** $subpath \n" if $debug; @@ -254,12 +254,12 @@ sub tool_man { elsif ($line =~ /^\#\#\s+(SUB)?COMMANDS/) { $section = 'commands'; } - elsif ($line =~ /^\#\#/) { + elsif ($line =~ /^\#\#[^#]/) { $section = ''; } # This will be a table containing subcommand names, links to man pages. - # The format is slightly different between buildah.md and subcommands. + # The format is slightly different between buildah.1.md and subcommands. elsif ($section eq 'commands') { # In tool.1.md if ($line =~ /^\|\s*buildah-(\S+?)\(\d\)/) { @@ -269,7 +269,7 @@ sub tool_man { } # In tool-.1.md - elsif ($line =~ /^\|\s+(\S+)\s+\|\s+\[\S+\]\((\S+)\.md\)/) { + elsif ($line =~ /^\|\s+(\S+)\s+\|\s+\[\S+\]\((\S+)\.1\.md\)/) { # $1 will be changed by recursion _*BEFORE*_ left-hand assignment my $subcmd = $1; if ($previous_subcmd gt $subcmd) { diff --git a/tests/validate/pr-should-include-tests b/tests/validate/pr-should-include-tests index 4cc843df02..907752987e 100755 --- a/tests/validate/pr-should-include-tests +++ b/tests/validate/pr-should-include-tests @@ -45,6 +45,7 @@ fi filtered_changes=$(git diff --name-status $base $head | awk '{print $2}' | fgrep -vx .cirrus.yml | + fgrep -vx .gitignore | fgrep -vx changelog.txt | fgrep -vx go.mod | fgrep -vx go.sum |