Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TaskSpecContainerSpec" /> class.
 /// </summary>
 /// <param name="image">The image name to use for the container.</param>
 /// <param name="labels">User-defined key/value data..</param>
 /// <param name="command">The command to be run in the image..</param>
 /// <param name="args">Arguments to the command..</param>
 /// <param name="hostname">The hostname to use for the container, as a valid RFC 1123 hostname..</param>
 /// <param name="env">A list of environment variables in the form &#x60;VAR&#x3D;value&#x60;..</param>
 /// <param name="dir">The working directory for commands to run in..</param>
 /// <param name="user">The user inside the container..</param>
 /// <param name="groups">A list of additional groups that the container process will run as..</param>
 /// <param name="privileges">privileges.</param>
 /// <param name="tTY">Whether a pseudo-TTY should be allocated..</param>
 /// <param name="openStdin">Open &#x60;stdin&#x60;.</param>
 /// <param name="readOnly">Mount the container&#39;s root filesystem as read only..</param>
 /// <param name="mounts">Specification for mounts to be added to containers created as part of the service..</param>
 /// <param name="stopSignal">Signal to stop the container..</param>
 /// <param name="stopGracePeriod">Amount of time to wait for the container to terminate before forcefully killing it..</param>
 /// <param name="healthCheck">healthCheck.</param>
 /// <param name="hosts">A list of hostname/IP mappings to add to the container&#39;s &#x60;hosts&#x60; file. The format of extra hosts is specified in the [hosts(5)](http://man7.org/linux/man-pages/man5/hosts.5.html) man page:      IP_address canonical_hostname [aliases...] .</param>
 /// <param name="dNSConfig">dNSConfig.</param>
 /// <param name="secrets">Secrets contains references to zero or more secrets that will be exposed to the service..</param>
 /// <param name="configs">Configs contains references to zero or more configs that will be exposed to the service..</param>
 /// <param name="isolation">Isolation technology of the containers running the service. (Windows only).</param>
 /// <param name="init">Run an init inside the container that forwards signals and reaps processes. This field is omitted if empty, and the default (as configured on the daemon) is used..</param>
 public TaskSpecContainerSpec(string image = default(string), Dictionary <string, string> labels = default(Dictionary <string, string>), List <string> command = default(List <string>), List <string> args = default(List <string>), string hostname = default(string), List <string> env = default(List <string>), string dir = default(string), string user = default(string), List <string> groups = default(List <string>), TaskSpecContainerSpecPrivileges privileges = default(TaskSpecContainerSpecPrivileges), bool?tTY = default(bool?), bool?openStdin = default(bool?), bool?readOnly = default(bool?), List <Mount> mounts = default(List <Mount>), string stopSignal = default(string), long?stopGracePeriod = default(long?), HealthConfig healthCheck = default(HealthConfig), List <string> hosts = default(List <string>), TaskSpecContainerSpecDNSConfig dNSConfig = default(TaskSpecContainerSpecDNSConfig), List <TaskSpecContainerSpecSecrets> secrets = default(List <TaskSpecContainerSpecSecrets>), List <TaskSpecContainerSpecConfigs> configs = default(List <TaskSpecContainerSpecConfigs>), IsolationEnum?isolation = default(IsolationEnum?), bool?init = default(bool?))
 {
     this.Image           = image;
     this.Labels          = labels;
     this.Command         = command;
     this.Args            = args;
     this.Hostname        = hostname;
     this.Env             = env;
     this.Dir             = dir;
     this.User            = user;
     this.Groups          = groups;
     this.Privileges      = privileges;
     this.TTY             = tTY;
     this.OpenStdin       = openStdin;
     this.ReadOnly        = readOnly;
     this.Mounts          = mounts;
     this.StopSignal      = stopSignal;
     this.StopGracePeriod = stopGracePeriod;
     this.HealthCheck     = healthCheck;
     this.Hosts           = hosts;
     this.DNSConfig       = dNSConfig;
     this.Secrets         = secrets;
     this.Configs         = configs;
     this.Isolation       = isolation;
     this.Init            = init;
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ContainerConfig" /> class.
 /// </summary>
 /// <param name="hostname">The hostname to use for the container, as a valid RFC 1123 hostname..</param>
 /// <param name="domainname">The domain name to use for the container..</param>
 /// <param name="user">The user that commands are run as inside the container..</param>
 /// <param name="attachStdin">Whether to attach to &#x60;stdin&#x60;. (default to false).</param>
 /// <param name="attachStdout">Whether to attach to &#x60;stdout&#x60;. (default to true).</param>
 /// <param name="attachStderr">Whether to attach to &#x60;stderr&#x60;. (default to true).</param>
 /// <param name="exposedPorts">An object mapping ports to an empty object in the form:  &#x60;{\&quot;&lt;port&gt;/&lt;tcp|udp|sctp&gt;\&quot;: {}}&#x60; .</param>
 /// <param name="tty">Attach standard streams to a TTY, including &#x60;stdin&#x60; if it is not closed. (default to false).</param>
 /// <param name="openStdin">Open &#x60;stdin&#x60; (default to false).</param>
 /// <param name="stdinOnce">Close &#x60;stdin&#x60; after one attached client disconnects (default to false).</param>
 /// <param name="env">A list of environment variables to set inside the container in the form &#x60;[\&quot;VAR&#x3D;value\&quot;, ...]&#x60;. A variable without &#x60;&#x3D;&#x60; is removed from the environment, rather than to have an empty value. .</param>
 /// <param name="cmd">Command to run specified as a string or an array of strings..</param>
 /// <param name="healthcheck">healthcheck.</param>
 /// <param name="argsEscaped">Command is already escaped (Windows only).</param>
 /// <param name="image">The name of the image to use when creating the container.</param>
 /// <param name="volumes">An object mapping mount point paths inside the container to empty objects..</param>
 /// <param name="workingDir">The working directory for commands to run in..</param>
 /// <param name="entrypoint">The entry point for the container as a string or an array of strings.  If the array consists of exactly one empty string (&#x60;[\&quot;\&quot;]&#x60;) then the entry point is reset to system default (i.e., the entry point used by docker when there is no &#x60;ENTRYPOINT&#x60; instruction in the &#x60;Dockerfile&#x60;). .</param>
 /// <param name="networkDisabled">Disable networking for the container..</param>
 /// <param name="macAddress">MAC address of the container..</param>
 /// <param name="onBuild">&#x60;ONBUILD&#x60; metadata that were defined in the image&#39;s &#x60;Dockerfile&#x60;..</param>
 /// <param name="labels">User-defined key/value metadata..</param>
 /// <param name="stopSignal">Signal to stop a container as a string or unsigned integer. (default to &quot;SIGTERM&quot;).</param>
 /// <param name="stopTimeout">Timeout to stop a container in seconds..</param>
 /// <param name="shell">Shell for when &#x60;RUN&#x60;, &#x60;CMD&#x60;, and &#x60;ENTRYPOINT&#x60; uses a shell..</param>
 public ContainerConfig(string hostname   = default(string),
                        string domainname = default(string),
                        string user       = default(string),
                        bool?attachStdin  = false,
                        bool?attachStdout = true,
                        bool?attachStderr = true,
                        Dictionary <string, Object> exposedPorts = default(Dictionary <string, Object>),
                        bool?tty                            = false,
                        bool?openStdin                      = false,
                        bool?stdinOnce                      = false,
                        List <string> env                   = default(List <string>),
                        List <string> cmd                   = default(List <string>),
                        HealthConfig healthcheck            = default(HealthConfig),
                        bool?argsEscaped                    = default(bool?),
                        string image                        = default(string),
                        Dictionary <string, Object> volumes = default(Dictionary <string, Object>),
                        string workingDir                   = default(string),
                        List <string> entrypoint            = default(List <string>),
                        bool?networkDisabled                = default(bool?),
                        string macAddress                   = default(string),
                        List <string> onBuild               = default(List <string>),
                        Dictionary <string, string> labels  = default(Dictionary <string, string>),
                        string stopSignal                   = "SIGTERM",
                        int?stopTimeout                     = default(int?),
                        List <string> shell                 = default(List <string>),
                        HostConfig hostConfig               = default(HostConfig))
 {
     this.Hostname   = hostname;
     this.Domainname = domainname;
     this.User       = user;
     // use default value if no "attachStdin" provided
     if (attachStdin == null)
     {
         this.AttachStdin = false;
     }
     else
     {
         this.AttachStdin = attachStdin;
     }
     // use default value if no "attachStdout" provided
     if (attachStdout == null)
     {
         this.AttachStdout = true;
     }
     else
     {
         this.AttachStdout = attachStdout;
     }
     // use default value if no "attachStderr" provided
     if (attachStderr == null)
     {
         this.AttachStderr = true;
     }
     else
     {
         this.AttachStderr = attachStderr;
     }
     this.ExposedPorts = exposedPorts;
     // use default value if no "tty" provided
     if (tty == null)
     {
         this.Tty = false;
     }
     else
     {
         this.Tty = tty;
     }
     // use default value if no "openStdin" provided
     if (openStdin == null)
     {
         this.OpenStdin = false;
     }
     else
     {
         this.OpenStdin = openStdin;
     }
     // use default value if no "stdinOnce" provided
     if (stdinOnce == null)
     {
         this.StdinOnce = false;
     }
     else
     {
         this.StdinOnce = stdinOnce;
     }
     this.Env             = env;
     this.Cmd             = cmd;
     this.Healthcheck     = healthcheck;
     this.ArgsEscaped     = argsEscaped;
     this.Image           = image;
     this.Volumes         = volumes;
     this.WorkingDir      = workingDir;
     this.Entrypoint      = entrypoint;
     this.NetworkDisabled = networkDisabled;
     this.MacAddress      = macAddress;
     this.OnBuild         = onBuild;
     this.Labels          = labels;
     // use default value if no "stopSignal" provided
     if (stopSignal == null)
     {
         this.StopSignal = "SIGTERM";
     }
     else
     {
         this.StopSignal = stopSignal;
     }
     this.StopTimeout = stopTimeout;
     this.Shell       = shell;
     this.HostConfig  = hostConfig;
 }