Class Container

  • All Implemented Interfaces:
    software.amazon.jsii.JsiiSerializable

    @Generated(value="jsii-pacmak/1.75.0 (build 63bb957)",
               date="2023-02-20T02:42:01.795Z")
    @Stability(Stable)
    public class Container
    extends software.amazon.jsii.JsiiObject
    A single application container that you want to run within a pod.
    • Constructor Detail

      • Container

        protected Container​(software.amazon.jsii.JsiiObjectRef objRef)
      • Container

        protected Container​(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
      • Container

        @Stability(Stable)
        public Container​(@NotNull
                         ContainerProps props)
        Parameters:
        props - This parameter is required.
    • Method Detail

      • addPort

        @Stability(Stable)
        public void addPort​(@NotNull
                            ContainerPort port)
        Add a port to expose from this container.

        Parameters:
        port - This parameter is required.
      • mount

        @Stability(Stable)
        public void mount​(@NotNull
                          String path,
                          @NotNull
                          IStorage storage,
                          @Nullable
                          MountOptions options)
        Mount a volume to a specific path so that it is accessible by the container.

        Every pod that is configured to use this container will autmoatically have access to the volume.

        Parameters:
        path - - The desired path in the container. This parameter is required.
        storage - - The storage to mount. This parameter is required.
        options -
      • mount

        @Stability(Stable)
        public void mount​(@NotNull
                          String path,
                          @NotNull
                          IStorage storage)
        Mount a volume to a specific path so that it is accessible by the container.

        Every pod that is configured to use this container will autmoatically have access to the volume.

        Parameters:
        path - - The desired path in the container. This parameter is required.
        storage - - The storage to mount. This parameter is required.
      • getEnv

        @Stability(Stable)
        @NotNull
        public Env getEnv()
        The environment of the container.
      • getImage

        @Stability(Stable)
        @NotNull
        public String getImage()
        The container image.
      • getImagePullPolicy

        @Stability(Stable)
        @NotNull
        public ImagePullPolicy getImagePullPolicy()
        Image pull policy for this container.
      • getMounts

        @Stability(Stable)
        @NotNull
        public List<VolumeMount> getMounts()
        Volume mounts configured for this container.
      • getName

        @Stability(Stable)
        @NotNull
        public String getName()
        The name of the container.
      • getPorts

        @Stability(Stable)
        @NotNull
        public List<ContainerPort> getPorts()
        Ports exposed by this containers.

        Returns a copy, use addPort to modify.

      • getSecurityContext

        @Stability(Stable)
        @NotNull
        public ContainerSecurityContext getSecurityContext()
        The security context of the container.
      • getArgs

        @Stability(Stable)
        @Nullable
        public List<String> getArgs()
        Arguments to the entrypoint.

        Returns:
        a copy of the arguments array, cannot be modified.
      • getCommand

        @Stability(Stable)
        @Nullable
        public List<String> getCommand()
        Entrypoint array (the command to execute when the container starts).

        Returns:
        a copy of the entrypoint array, cannot be modified
      • getPort

        @Stability(Deprecated)
        @Deprecated
        @Nullable
        public Number getPort()
        Deprecated.
        - use `portNumber`.
      • getPortNumber

        @Stability(Stable)
        @Nullable
        public Number getPortNumber()
        The port number that was configured for this container.

        If undefined, either the container doesn't expose a port, or its port configuration is stored in the ports field.

      • getWorkingDir

        @Stability(Stable)
        @Nullable
        public String getWorkingDir()
        The working directory inside the container.