Ejemplo n.º 1
0
        public ContainerHook(DockerClient client, ContainerHookConfig config)
        {
            this.client = client;
            this.containerListParams    = new Docker.DotNet.Models.ContainersListParameters();
            containerListParams.Filters = new Dictionary <string, IDictionary <string, bool> > {
                {
                    "name",
                    new Dictionary <string, bool> {
                        { config.SafeName, true }
                    }
                }
            };
            containerListParams.Limit = 1;

            this.validate(config);

            this.Name              = config.Name;
            this.Tag               = config.Tag;
            this.SafeName          = config.SafeName;
            this.configSrc         = config.ConfigSrc;
            this.configVolSrc      = config.ConfigVolSrc;
            this.configVolDest     = config.ConfigVolDest;
            this.mounts            = config.Mounts;
            this.portMappings      = config.PortMappings;
            this.envVars           = config.EnvVariables;
            this.networkMode       = config.NetworkMode;
            this.capabilities      = config.Capabilities;
            this.memoryReservation = config.MemCap;
            this.privileged        = config.Privileged;
            this.restartPolicy     = config.RestartPolicy;
            this.authConfig        = config.AuthConfig;
            this.forceUpgrade      = config.ForceUpgrade;
        }