| Fields inherited from class | Fields |
|---|---|
class DefaultTask |
TASK_NAME, TASK_DESCRIPTION, TASK_GROUP, TASK_TYPE, TASK_DEPENDS_ON, TASK_OVERWRITE, TASK_ACTION, TASK_CONSTRUCTOR_ARGS |
class AbstractTask |
TASK_NAME, TASK_DESCRIPTION, TASK_GROUP, TASK_TYPE, TASK_DEPENDS_ON, TASK_OVERWRITE, TASK_ACTION, TASK_CONSTRUCTOR_ARGS |
| Type | Name and description |
|---|---|
File |
destFile |
List<Instruction> |
instructions |
| Constructor and description |
|---|
Dockerfile
() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
addFile(String src, String dest)The ADD instruction copies new files, directories or remote file URLs from |
|
void |
addFile(Closure src, Closure dest)The ADD instruction copies new files, directories or remote file URLs from |
|
void |
arg(String arg)The ARG instruction defines a variable that users can pass at build-time to the builder. |
|
void |
copyFile(String src, String dest, String stageName = null)The COPY instruction copies new files or directories from |
|
void |
copyFile(Closure src, Closure dest, Closure stageName)The COPY instruction copies new files or directories from |
|
void |
create() |
|
void |
defaultCommand(String... command)The main purpose of a CMD instruction is to provide defaults for an executing container. |
|
void |
defaultCommand(Closure command)The main purpose of a CMD instruction is to provide defaults for an executing container. |
|
void |
entryPoint(String... entryPoint)An ENTRYPOINT allows you to configure a container that will run as an executable. |
|
void |
entryPoint(Closure entryPoint)An ENTRYPOINT allows you to configure a container that will run as an executable. |
|
void |
environmentVariable(String key, String value)The ENV instruction sets the environment variable |
|
void |
environmentVariable(Map<String, String> envVars)The ENV instruction sets multiple environment variables at once. |
|
void |
environmentVariable(Closure envVars)The ENV instruction sets multiple environment variables at once. |
|
void |
exposePort(Integer... ports)The EXPOSE instruction informs Docker that the container will listen on the specified network ports at runtime. |
|
void |
exposePort(Closure ports)The EXPOSE instruction informs Docker that the container will listen on the specified network ports at runtime. |
|
void |
from(String image, String stageName = null)The FROM instruction sets the Base Image for subsequent instructions. |
|
void |
from(Closure image, Closure stageName = null)The FROM instruction sets the Base Image for subsequent instructions. |
|
void |
instruction(String instruction)Adds a full instruction as String. |
|
void |
instruction(Closure instruction)Adds a full instruction as Closure with return type String. |
|
void |
instructionsFromTemplate(File template) |
|
void |
instructionsFromTemplate(String templatePath) |
|
void |
instructionsFromTemplate(Closure templatePath) |
|
void |
label(Map<String, String> labels)The LABEL instruction adds metadata to an image. |
|
void |
label(Closure labels)The LABEL instruction adds metadata to an image. |
|
void |
maintainer(String maintainer)The MAINTAINER instruction allows you to set the Author field of the generated images. |
|
void |
maintainer(Closure maintainer)The MAINTAINER instruction allows you to set the Author field of the generated images. |
|
void |
onBuild(String instruction)The ONBUILD instruction adds to the image a trigger instruction to be executed at a later time, when the image is used as the base for another build. |
|
void |
onBuild(Closure instruction)The ONBUILD instruction adds to the image a trigger instruction to be executed at a later time, when the image is used as the base for another build. |
|
void |
runCommand(String command)The RUN instruction will execute any commands in a new layer on top of the current image and commit the results. |
|
void |
runCommand(Closure command)The RUN instruction will execute any commands in a new layer on top of the current image and commit the results. |
|
void |
user(String user)The USER instruction sets the user name or UID to use when running the image and for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile. |
|
void |
user(Closure user)The USER instruction sets the user name or UID to use when running the image and for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile. |
|
void |
volume(String... volume)The VOLUME instruction will create a mount point with the specified name and mark it as holding externally mounted volumes from native host or other containers. |
|
void |
volume(Closure volume)The VOLUME instruction will create a mount point with the specified name and mark it as holding externally mounted volumes from native host or other containers. |
|
void |
workingDir(String dir)The WORKDIR instruction sets the working directory for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile. |
|
void |
workingDir(Closure dir)The WORKDIR instruction sets the working directory for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile. |
The ADD instruction copies new files, directories
or remote file URLs from src - Source filedest - Destination path
The ADD instruction copies new files, directories
or remote file URLs from src - Source filedest - Destination path
The ARG instruction defines a variable that users can pass at build-time to the builder.
arg - Argument to pass, possibly with default value. The COPY instruction copies new files or directories
from src - Source filedest - Destination pathstageName - stage name in case of multi stage build
The COPY instruction copies new files or directories
from src - Source filedest - Destination pathstageName - closure returning stage name in case of multi stage build
The main purpose of a CMD instruction is to provide defaults for an executing container.
command - CommandThe main purpose of a CMD instruction is to provide defaults for an executing container.
command - CommandAn ENTRYPOINT allows you to configure a container that will run as an executable.
entryPoint - Entry pointAn ENTRYPOINT allows you to configure a container that will run as an executable.
entryPoint - Entry point The ENV instruction sets the environment variable
key - Keyvalue - Value
The ENV instruction sets multiple environment variables at once.
envVars - Environment variablesThe ENV instruction sets multiple environment variables at once.
envVars - Environment variablesThe EXPOSE instruction informs Docker that the container will listen on the specified network ports at runtime.
ports - PortsThe EXPOSE instruction informs Docker that the container will listen on the specified network ports at runtime.
ports - PortsThe FROM instruction sets the Base Image for subsequent instructions.
image - Base image namestageName - stage name in case of multi-stage builds (default null)The FROM instruction sets the Base Image for subsequent instructions.
image - Base image namestageName - closure returning stage name in case of multi-stage builds (default null)Adds a full instruction as String. Example:
task createDockerfile(type: Dockerfile) {
instruction 'FROM ubuntu:14.04'
instruction 'MAINTAINER Benjamin Muschko "benjamin.muschko@gmail.com"'
}
instruction - Instruction as StringAdds a full instruction as Closure with return type String. Example:
task createDockerfile(type: Dockerfile) {
instruction { 'FROM ubuntu:14.04' }
instruction { 'MAINTAINER Benjamin Muschko "benjamin.muschko@gmail.com"' }
}
instruction - Instruction as ClosureThe LABEL instruction adds metadata to an image.
labels - LabelsThe LABEL instruction adds metadata to an image.
labels - LabelsThe MAINTAINER instruction allows you to set the Author field of the generated images.
maintainer - MaintainerThe MAINTAINER instruction allows you to set the Author field of the generated images.
maintainer - MaintainerThe ONBUILD instruction adds to the image a trigger instruction to be executed at a later time, when the image is used as the base for another build.
instruction - InstructionThe ONBUILD instruction adds to the image a trigger instruction to be executed at a later time, when the image is used as the base for another build.
instruction - InstructionThe RUN instruction will execute any commands in a new layer on top of the current image and commit the results.
command - CommandThe RUN instruction will execute any commands in a new layer on top of the current image and commit the results.
command - CommandThe USER instruction sets the user name or UID to use when running the image and for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile.
user - UserThe USER instruction sets the user name or UID to use when running the image and for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile.
user - UserThe VOLUME instruction will create a mount point with the specified name and mark it as holding externally mounted volumes from native host or other containers.
volume - VolumeThe VOLUME instruction will create a mount point with the specified name and mark it as holding externally mounted volumes from native host or other containers.
volume - VolumeThe WORKDIR instruction sets the working directory for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile.
dir - DirectoryThe WORKDIR instruction sets the working directory for any RUN, CMD and ENTRYPOINT instructions that follow it in the Dockerfile.
dir - DirectoryGroovy Documentation