Class DockerCompose

  • All Implemented Interfaces:
    software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

    @Generated(value="jsii-pacmak/1.96.0 (build 921e240)",
               date="2024-03-28T21:16:42.739Z")
    @Stability(Experimental)
    public class DockerCompose
    extends Component
    (experimental) Create a docker-compose YAML file.
    • Constructor Detail

      • DockerCompose

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

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

        @Stability(Experimental)
        public DockerCompose​(@NotNull
                             Project project,
                             @Nullable
                             DockerComposeProps props)
        Parameters:
        project - This parameter is required.
        props -
      • DockerCompose

        @Stability(Experimental)
        public DockerCompose​(@NotNull
                             Project project)
        Parameters:
        project - This parameter is required.
    • Method Detail

      • bindVolume

        @Stability(Experimental)
        @NotNull
        public static IDockerComposeVolumeBinding bindVolume​(@NotNull
                                                             String sourcePath,
                                                             @NotNull
                                                             String targetPath)
        (experimental) Create a bind volume that binds a host path to the target path in the container.

        Parameters:
        sourcePath - Host path name. This parameter is required.
        targetPath - Target path name. This parameter is required.
      • namedVolume

        @Stability(Experimental)
        @NotNull
        public static IDockerComposeVolumeBinding namedVolume​(@NotNull
                                                              String volumeName,
                                                              @NotNull
                                                              String targetPath,
                                                              @Nullable
                                                              DockerComposeVolumeConfig options)
        (experimental) Create a named volume and mount it to the target path.

        If you use this named volume in several services, the volume will be shared. In this case, the volume configuration of the first-provided options are used.

        Parameters:
        volumeName - Name of the volume. This parameter is required.
        targetPath - Target path. This parameter is required.
        options - volume configuration (default: docker compose defaults).
      • namedVolume

        @Stability(Experimental)
        @NotNull
        public static IDockerComposeVolumeBinding namedVolume​(@NotNull
                                                              String volumeName,
                                                              @NotNull
                                                              String targetPath)
        (experimental) Create a named volume and mount it to the target path.

        If you use this named volume in several services, the volume will be shared. In this case, the volume configuration of the first-provided options are used.

        Parameters:
        volumeName - Name of the volume. This parameter is required.
        targetPath - Target path. This parameter is required.
      • network

        @Stability(Experimental)
        @NotNull
        public static IDockerComposeNetworkBinding network​(@NotNull
                                                           String networkName,
                                                           @Nullable
                                                           DockerComposeNetworkConfig options)
        (experimental) Create a named network and mount it to the target path.

        If you use this named network in several services, the network will be shared. In this case, the network configuration of the first-provided options are used.

        Parameters:
        networkName - Name of the network. This parameter is required.
        options - network configuration.
      • network

        @Stability(Experimental)
        @NotNull
        public static IDockerComposeNetworkBinding network​(@NotNull
                                                           String networkName)
        (experimental) Create a named network and mount it to the target path.

        If you use this named network in several services, the network will be shared. In this case, the network configuration of the first-provided options are used.

        Parameters:
        networkName - Name of the network. This parameter is required.
      • portMapping

        @Stability(Experimental)
        @NotNull
        public static DockerComposeServicePort portMapping​(@NotNull
                                                           Number publishedPort,
                                                           @NotNull
                                                           Number targetPort,
                                                           @Nullable
                                                           DockerComposePortMappingOptions options)
        (experimental) Create a port mapping.

        Parameters:
        publishedPort - Published port number. This parameter is required.
        targetPort - Container's port number. This parameter is required.
        options - Port mapping options.
      • portMapping

        @Stability(Experimental)
        @NotNull
        public static DockerComposeServicePort portMapping​(@NotNull
                                                           Number publishedPort,
                                                           @NotNull
                                                           Number targetPort)
        (experimental) Create a port mapping.

        Parameters:
        publishedPort - Published port number. This parameter is required.
        targetPort - Container's port number. This parameter is required.
      • serviceName

        @Stability(Experimental)
        @NotNull
        public static IDockerComposeServiceName serviceName​(@NotNull
                                                            String serviceName)
        (experimental) Depends on a service name.

        Parameters:
        serviceName - This parameter is required.
      • addService

        @Stability(Experimental)
        @NotNull
        public DockerComposeService addService​(@NotNull
                                               String serviceName,
                                               @NotNull
                                               DockerComposeServiceDescription description)
        (experimental) Add a service to the docker-compose file.

        Parameters:
        serviceName - name of the service. This parameter is required.
        description - a service description. This parameter is required.
      • getFile

        @Stability(Experimental)
        @NotNull
        public YamlFile getFile()
        (experimental) The Docker Compose file.