Create Json config.
Used to send to docker server while creating new container.
Created by matank on 4/19/15.
| Type | Name and description |
|---|---|
boolean |
AttachStderr |
boolean |
AttachStdin |
boolean |
AttachStdout |
java.util.List<java.lang.String> |
Cmd |
java.lang.Object |
CpuShares |
java.lang.Object |
Cpuset |
java.lang.String |
Domainname |
java.util.List<java.lang.String> |
Entrypoint |
java.util.List<java.lang.String> |
Env |
java.util.Map<java.lang.String, java.util.Map> |
ExposedPorts |
java.util.Map<java.lang.String, java.lang.Object> |
HostConfig |
java.lang.String |
Hostname |
java.lang.String |
Image |
java.lang.String |
MacAddress |
long |
Memory |
long |
MemorySwap |
boolean |
NetworkDisabled |
java.util.Map<java.lang.String, java.lang.Object> |
NetworkingConfig |
java.lang.Object |
OnBuild |
boolean |
OpenStdin |
java.lang.Object |
PortSpecs |
boolean |
StdinOnce |
boolean |
Tty |
java.lang.String |
User |
java.util.Map<java.lang.String, java.util.Map> |
Volumes |
java.lang.String |
WorkingDir |
| Type | Name and description |
|---|---|
CreateConfig |
addCommand(java.lang.String command, boolean supportMultiCommand = true)Add command to container. |
CreateConfig |
addCommand(java.util.List command)Add command to container. |
CreateConfig |
addCommandAsBashScript(java.lang.Object command)Add command in a bash script form. |
CreateConfig |
addCommands(java.util.List<java.lang.String> commands)Add list of commands. |
CreateConfig |
addEntryPoint(java.lang.String entryPoint)Set entrypoint to run when container is started. |
CreateConfig |
addEntryPoint(java.util.List<java.lang.String> entryPoints)Set entrypoint to run when container is started. |
CreateConfig |
addEnv(java.lang.String key, java.lang.String value)Add environment to container. |
CreateConfig |
addEnvs(java.util.Map<java.lang.String, java.lang.String> env)Add environments to container. |
CreateConfig |
addExposedPort(int port, java.lang.String protocol)Add port to expose when container will run. |
CreateConfig |
addHost(java.lang.String hostname, java.lang.String ip)Add hosts to /etc/hosts |
CreateConfig |
addHosts(java.util.Map<java.lang.String, java.lang.String> hostMap)Add multiple hosts to /etc/hosts |
CreateConfig |
addLinkToNetwork(java.lang.String networkModeName, java.lang.String containerName, java.lang.String internalName = null) |
CreateConfig |
addVolume(java.lang.String volume)Add volume to the container. |
CreateConfig |
addVolumes(java.util.List<java.lang.String> volumes)Add multiple volumes. |
CreateConfig |
attachStderr(boolean attachStrerr) |
CreateConfig |
attachStdin(boolean attachStdin) |
CreateConfig |
attachStdout(boolean attachStdout) |
CreateConfig |
commands(java.util.List<java.lang.String> commands) |
CreateConfig |
cpuShares(java.lang.Object cpuShares) |
CreateConfig |
cpuset(java.lang.Object cpuset) |
CreateConfig |
domainName(java.lang.String domainName) |
CreateConfig |
env(java.lang.String key, java.lang.String value) |
CreateConfig |
env(java.util.Map<java.lang.String, java.lang.String> env) |
CreateConfig |
hostname(java.lang.String hostname) |
CreateConfig |
image(DockerImage image)Set image for the container to start from. |
CreateConfig |
image(java.lang.String image)Set image for the container to start from. |
CreateConfig |
macAddress(java.lang.String macAddress) |
CreateConfig |
memory(long memory) |
CreateConfig |
memorySwap(long memorySwap) |
CreateConfig |
networkDisabled(boolean networkDisabled) |
CreateConfig |
onBuild(java.lang.Object onBuild) |
CreateConfig |
openStdin(boolean openStdin) |
CreateConfig |
portSpecs(java.lang.Object portSpecs) |
CreateConfig |
setUser(java.lang.String user) |
CreateConfig |
stdinOnce(boolean stdinOnce) |
java.lang.String |
toJson() |
CreateConfig |
tty(boolean tty) |
CreateConfig |
workingDir(java.lang.String workingDir) |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Add command to container.
NOTE: if EntryPoint is set with "exec $@" at the end to run another command,
then the commands should be written as bash script and supportMultiCommand should be set as FALSE.
(e.g. createConfig.addCommand("ifconfig ; hostname ; env", false))
command - Command to run inside container.supportMultiCommand - if TRUE then "/bin/bash -c", if FALSE then nothing is prefixed. Add command to container.
Use this method in case /bin/bash is not available in the image, In other cases pass your command as string.
(e.g. createConfig.addCommand(["ping", address]))
command - List of command and args.Add command in a bash script form. NOTE: once using this command, it will overwrite any command added before using addCommand method.
command - command to add to the bash script Add list of commands.
All the commands set here will be prefixed with "/bin/bash -c" to be able to run them all.
commands - Commands to run inside container. Set entrypoint to run when container is started.
If entrypoint is a bash script ended with $@ then make sure to add command
with supportMultiCommand set to FALSE.
http://docs.docker.com/reference/builder/#entrypoint
entryPoint - command to exec or path to file to run Set entrypoint to run when container is started.
This form is used to set in exec form.
http://docs.docker.com/reference/builder/#entrypoint
Add environment to container.
key - environment keyvalue - environment keyAdd environments to container.
env - List of variables (e.g. ["key", "value"]) Add port to expose when container will run.
Use it if you would to expose port the wasn't exposed when the image was built.
port - Port to expose.protocol - Protocol to expose.Add hosts to /etc/hosts
hostname - hostname to useip - The ip to redirect toAdd multiple hosts to /etc/hosts
hostMap - Map containing hostname as key and ip as value Add volume to the container.
The make the actual mounting use dockerContainer.addBinds([hostPath, volume])
volume - Will be the path of the volume inside to containerAdd multiple volumes.
volume - List of volumes to create in the container Set image for the container to start from.
image - Image full name (e.g dockerImage.getFullImageName()) Set image for the container to start from.
Common use will be dockerImage.getFullImageName()
image - Image full name