Docker Containers

Containers are the preferred mechanism for deploying applications built with Nstream. This allows the dependencies and Java runtime to be packaged together with known versions.



Google provides a great plugin called Jib that will build a container as part of your Gradle lifecycle. The following code snippet is from our Cellular application.

    mainClassName = 'swim.cellular.CellularPlane'
    jib {
    from {
      image = "openjdk:11"
    to {
      image = "nstream/demo-cellular:${version}"
      auth {
        username = "$System.env.REGISTRY_USERNAME"
        password = "$System.env.REGISTRY_PASSWORD"
    container {
      mainClass = mainClassName
      ports = ['9001/tcp']
      jvmFlags = ['-Dswim.config=/config/server.recon']
    extraDirectories {
      paths {
        path {
          // copies a single-file.xml
          from = 'src/main/resources'
          into = '/config'
          includes = ['*.recon']

Build a local container

gradle jibDockerBuild

Build container for a docker registry.

gradle jib


Google also provides a plugin for Maven.


Build a local container

mvn compile jib:dockerBuild

Build container for a docker registry.

mvn compile jib:build