Methods
Method new()
Create a new Dockerfile object.
Arguments
FROM
The base image.
AS
The name of the image.
Returns
A Dockerfile object.
Method RUN()
Add a RUN command.
Returns
the Dockerfile object, invisibly.
Method ADD()
Add a ADD command.
Arguments
from
The source file.
to
The destination file.
force
If TRUE, overwrite the destination file.
Returns
the Dockerfile object, invisibly.
Method COPY()
Add a COPY command.
Arguments
from
The source file.
to
The destination file.
stage
Optional. Name of the build stage (e.g., "builder"
) to copy files from. This corresponds to the --from=
part in a Dockerfile COPY instruction (e.g., COPY --from=builder /source /dest
). If NULL
, the --from=
argument is omitted.
force
If TRUE, overwrite the destination file.
Returns
the Dockerfile object, invisibly.
Method WORKDIR()
Add a WORKDIR command.
Arguments
where
The working directory.
Returns
the Dockerfile object, invisibly.
Method EXPOSE()
Add a EXPOSE command.
Returns
the Dockerfile object, invisibly.
Method VOLUME()
Add a VOLUME command.
Arguments
volume
The volume to add.
Returns
the Dockerfile object, invisibly.
Method CMD()
Add a CMD command.
Returns
the Dockerfile object, invisibly.
Method LABEL()
Add a LABEL command.
Arguments
key, value
The key and value of the label.
Returns
the Dockerfile object, invisibly.
Method ENV()
Add a ENV command.
Arguments
key, value
The key and value of the label.
Returns
the Dockerfile object, invisibly.
Method ENTRYPOINT()
Add a ENTRYPOINT command.
Returns
the Dockerfile object, invisibly.
Method USER()
Add a USER command.
Returns
the Dockerfile object, invisibly.
Method ARG()
Add a ARG command.
Arguments
arg
The argument to add.
ahead
If TRUE, add the argument at the beginning of the Dockerfile.
Returns
the Dockerfile object, invisibly.
Method ONBUILD()
Add a ONBUILD command.
Returns
the Dockerfile object, invisibly.
Method STOPSIGNAL()
Add a STOPSIGNAL command.
Arguments
signal
The signal to add.
Returns
the Dockerfile object, invisibly.
Method HEALTHCHECK()
Add a HEALTHCHECK command.
Returns
the Dockerfile object, invisibly.
Method SHELL()
Add a SHELL command.
Returns
the Dockerfile object, invisibly.
Method MAINTAINER()
Add a MAINTAINER command.
Arguments
name, email
The name and email of the maintainer.
Returns
the Dockerfile object, invisibly.
Method custom()
Add a custom command.
Arguments
base, cmd
The base and command to add.
Returns
the Dockerfile object, invisibly.
Add a comment.
Arguments
comment
The comment to add.
Returns
the Dockerfile object, invisibly.
Print the Dockerfile.
Returns
used for side effect
Write the Dockerfile to a file.
Arguments
as
The file to write to.
append
boolean, if TRUE append to file.
Returns
used for side effect
Method switch_cmd()
Switch commands.
Arguments
a, b
The commands to switch.
Returns
the Dockerfile object, invisibly.
Method remove_cmd()
Remove a command.
Arguments
where
The commands to remove.
Returns
the Dockerfile object, invisibly.
Method add_after()
Add a command after another.
Arguments
cmd
The command to add.
after
Where to add the cmd
Returns
the Dockerfile object, invisibly.
Method clone()
The objects of this class are cloneable with this method.
Arguments
deep
Whether to make a deep clone.