CONTAINERFILE(5) (NAME) Containerfile - (Dockerfile) (INTRODUCTION) Containerfile . Makefile . (Podman Buildah Docker) Containerfile . Containerfile . Containerfile . Containerfile buildah build podman build docker build Containerfile . Podman Buildah Containerfile Dockerfile . Dockerfile . Dockerfile . Containerfile Dockerfile . (SYNOPSIS) INSTRUCTION arguments : FROM image (DESCRIPTION) Containerfile . Containerfile Makefile . (USAGE) buildah build . podman build . -- (commit) . . buildah build -t repository/tag . podman build -t repository/tag . -- (tag) . (ID) . . . (FORMAT) FROM image [AS ] FROM image:tag [AS ] FROM image@digest [AS ] -- FROM . Containerfile ARG FROM . FROM ARG FROM . . . -- FROM Containerfile . -- FROM Containerfile ARG . -- FROM Containerfile . commit FROM . -- FROM latest . . -- FROM latest . . -- AS name . Containerfile FROM COPY --from= . MAINTAINER -- MAINTAINER Author (/) . . RUN -- RUN : # the command is run in a shell - /bin/sh -c RUN # Executable form RUN ["executable", "param1", "param2"] RUN mounts --mount=type=TYPE,TYPE-SPECIFIC-OPTION[,...] mount bind cache secret tmpfs. e.g. mount=type=bind,source=/path/on/host,destination=/path/in/container,relabel=shared mount=type=tmpfs,tmpfs-size=512M,destination=/path/in/container mount=type=secret,id=mysecret cat /run/secrets/mysecret Common Options: . src, source: bind volume. bind . . dst, destination, target: . . ro, read-only: : true () false. Options specific to bind: . bind-propagation: shared, slave, private, rshared, rslave rprivate (). . bind-nonrecursive: ( ). . from: . . . relabel=shared, z: src (shared). . relabel=private, Z: src (private). SELinux . relabel=shared z . relabel=private Z . . rw, read-write: . Options specific to tmpfs: . tmpfs-size: tmpfs ( ). . tmpfs-mode: ( 700 0700 1777). . tmpcopyup: tmpfs tmpfs . Options specific to cache: . id: . . mode: ( 0755). . ro, readonly: . . uid: . . gid: . . from: ( ). . rw, read-write: . RUN --network RUN --network . : --network= +------------------------------------------------+-------------------------------------------------------------------+ | (Type) | (Description) | +------------------------------------------------+-------------------------------------------------------------------+ | | | +------------------------------------------------+-------------------------------------------------------------------+ |<#run---networkdefault> () | . | +------------------------------------------------+-------------------------------------------------------------------+ | | | +------------------------------------------------+-------------------------------------------------------------------+ |<#run---networknone> | . | +------------------------------------------------+-------------------------------------------------------------------+ | | | +------------------------------------------------+-------------------------------------------------------------------+ |<#run---networkhost> | . | +------------------------------------------------+-------------------------------------------------------------------+ RUN --network=default . RUN --network=none ( lo ). : FROM python:3.6 ADD mypackage.tgz wheels/ RUN --network=none pip install --find-links wheels mypackage pip tar . RUN --network=host ( buildah build --network=host ). RUN (Secrets) RUN () . RUN (commit) . RUN --mount . () . --secret . --mount=type=secret,TYPE-SPECIFIC-OPTION[,...] o id buildah build --secret podman build --secret . RUN --mount Containerfile . o dst|target|destination RUN . o type=secret --mount . # : RUN --mount=type=secret,id=mysecret cat /run/secrets/mysecret # : RUN --mount=type=secret,id=mysecret,dst=/foobar cat /foobar --secret . : buildah build --no-cache --secret id=mysecret,src=mysecret.txt . -- RUN (commit) . Containerfile . -- RUN commit commit . . (exec form) RUN /bin/sh . exec JSON (") ('). CMD -- CMD : # 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 -- Containerfile CMD . CMD CMD . CMD . . ENTRYPOINT . shell exec CMD . CMD /bin/sh -c : exec JSON (") ('). FROM ubuntu CMD echo "This is a test." | wc - -- command JSON . CMD . : FROM ubuntu CMD ["/usr/bin/wc","--help"] -- ENTRYPOINT CMD . podman run docker run CMD . RUN CMD . RUN . CMD . LABEL -- LABEL = [= ...] LABEL [ ] LABEL [ ] ... LABEL . LABEL - . LABEL . LABEL . 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="" . - . LABEL FROM . key . buildah inspect . EXPOSE -- EXPOSE [...] EXPOSE . (port redirection) . ENV -- ENV ENV . RUN ENTRYPOINT CMD . = . ENV . podman inspect podman run --env = . "ENV DEBIAN_FRONTEND=noninteractive" ( podman run -t -i image bash) . ADD -- ADD : ADD # Required for paths with whitespace ADD ["",... ""] ADD URL . ( ) . WORKDIR . (tar, gzip, bzip2 ) . URL . 0755 uid gid 0 . COPY -- COPY : COPY [--chown=:] [--chmod=] # Required for paths with whitespace COPY [--chown=:] [--chmod=] ["",... ""] COPY . URL . WORKDIR . COPY . 0755 uid gid 0 . --chown=: . ( /etc/passwd /etc/groups ) uid gid . . . --chmod= . --from=name . . ENTRYPOINT -- ENTRYPOINT : # executable form ENTRYPOINT ["executable", "param1", "param2"]` # run command in a shell - /bin/sh -c ENTRYPOINT command param1 param2 -- ENTRYPOINT . ENTRYPOINT . ENTRYPOINT podman run . CMD . entrypoint podman run -d -d ENTRYPOINT . JSON ENTRYPOINT ( ) CMD . ENTRYPOINT podman run CMD podman run . ENTRYPOINT CMD /bin/sh -c : FROM ubuntu ENTRYPOINT wc -l - Containerfile stdin ( "-") ( "-l"). CMD : FROM ubuntu CMD ["-l", "-"] ENTRYPOINT ["/usr/bin/wc"] VOLUME -- VOLUME ["/data"] VOLUME (mount point) . USER -- USER daemon UID . USER GID . : USER [user | user:group | uid | uid:gid | user:gid | uid:group ] USER root . USER Containerfile . WORKDIR -- WORKDIR /path/to/workdir WORKDIR RUN CMD ENTRYPOINT COPY ADD Containerfile . Containerfile . WORKDIR . : WORKDIR /a WORKDIR b WORKDIR c RUN pwd pwd a/b/c . ARG -- ARG [=] ARG podman build buildah build --build-arg = . Containerfile . FROM Containerfile Arg nil Containerfile . [Warning] One or more build-args [foo] were not consumed Containerfile ARG . Containerfile : FROM busybox ARG user1 ARG buildno ... Containerfile ARG : FROM busybox ARG user1=someuser ARG buildno=1 ... ARG . ARG Containerfile . Containerfile : 1 FROM busybox 2 USER ${user:-some_user} 3 ARG user 4 USER $user ... : $ podman build --build-arg user=what_user Containerfile USER some_user user . USER what_user user what_user . ARG . : . podman history . ARG ENV RUN . ENV ARG . Containerfile ENV ARG : 1 FROM ubuntu 2 ARG CONT_IMG_VER 3 ENV CONT_IMG_VER=v1.0.0 4 RUN echo $CONT_IMG_VER : $ podman build --build-arg CONT_IMG_VER=v2.0.1 Containerfile RUN ARG (v2.0.1) v1.0.0 . . ENV ARG ENV : 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 ARG ENV . podman build --build-arg : $ podman build Containerfile Containerfile CONT_IMG_VER v1.0.0 ENV . ENV . Containerfile . <#environment-replacement> ARG ARG Containerfile : o HTTP_PROXY o http_proxy o HTTPS_PROXY o https_proxy o FTP_PROXY o ftp_proxy o NO_PROXY o no_proxy o ALL_PROXY o all_proxy --build-arg : $ podman build --build-arg HTTPS_PROXY=https://my-proxy.example.com . ARG // (Platform/OS/Arch ARG) -- ARG (multi-arch) Containerfile . RUN curl ... / RUN . ARG . . ARG . FROM Containerfile . ARG : o TARGET... ( <<>> ) . : o TARGETOS: linux o TARGETARCH: amd64 o TARGETPLATFORM: linux/amd64 o TARGETVARIANT: TARGETARCH o BUILD... ( <<>> ) : o BUILDOS: o BUILDARCH: o BUILDPLATFORM: / o BUILDVARIANT: BUILDARCH Containerfile TARGETARCH : FROM busybox ARG TARGETARCH RUN curl -sSf -O https://example.com/downloads/bin-${TARGETARCH}.zip linux/amd64 ( qemu-user-static) : $ podman build --platform linux/s390x . curl https://example.com/downloads/bin-s390x.zip linux/s390x . : build- arg podman farm build . ONBUILD -- ONBUILD [INSTRUCTION] ONBUILD () . . FROM Containerfile . . . . . . ADD RUN . -- Containerfile - . ONBUILD . (SEE ALSO) buildah(1), podman(1), docker(1) (HISTORY) Zac Dover (zdover at redhat dot com) Dockerfile docker.com Brian Goff (cpuguy83@gmail.com) Sally O'Malley (somalley@redhat.com) Addam Hardy (addam.hardy@gmail.com) Dockerfile Containerfile Dan Walsh (dwalsh@redhat.com) CONTAINERFILE(5)