Skip to content
This repository was archived by the owner on Mar 21, 2022. It is now read-only.
This repository was archived by the owner on Mar 21, 2022. It is now read-only.

Replace empty envs with "" and not "null" #212

@julian-eggers

Description

@julian-eggers

Description

Replace empty envs with "" and not "null".
This causes unnecessary application-errors (see command below).

How to reproduce

      <plugin>
        <groupId>com.spotify</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>0.4.3</version>
        <configuration>
          <serverId>dockerhub-jeggers</serverId>
          <imageName>jeggers/${project.artifactId}</imageName>
          <forceTags>true</forceTags>
          <imageTags>
            <imageTag>${project.version}</imageTag>
            <imageTag>latest</imageTag>
          </imageTags>
          <baseImage>jeanblanchard/java:serverjre-8</baseImage>
          <volumes>
            <volume>/var/log/apps</volume>
          </volumes>
          <env>
            <REGISTRY_USERNAME></REGISTRY_USERNAME>
            <REGISTRY_EMAIL></REGISTRY_EMAIL>
            <REGISTRY_PASSWORD></REGISTRY_PASSWORD>
            <HOST_URI></HOST_URI>
            <HOST_CERTIFICATES></HOST_CERTIFICATES>
            <HTTP_PORT>7777</HTTP_PORT>
            <JAVA_OPTS>-Dfoo=bar</JAVA_OPTS>
          </env>
          <cmd>["/bin/sh", "-c", "java -Ddocker.registry.username=${REGISTRY_USERNAME} -Ddocker.registry.email=${REGISTRY_EMAIL} -Ddocker.registry.password=${REGISTRY_PASSWORD} -Ddocker.host.uri=${HOST_URI} -Ddocker.host.certificates.directory=${HOST_CERTIFICATES} -Dserver.port=${HTTP_PORT} -Dfile.encoding=UTF-8 ${JAVA_OPTS} -jar /${project.build.finalName}.${project.packaging}"]</cmd>
          <resources>
            <resource>
              <targetPath>/</targetPath>
              <directory>${project.build.directory}</directory>
              <include>${project.build.finalName}.${project.packaging}</include>
            </resource>
          </resources>
        </configuration>
      </plugin>

What do you expect

Replace empty envs with "" and not "null".

What happened instead

The following command is executed, when the empty envs are not overwritten:

java -Ddocker.registry.username=null -Ddocker.registry.email=null -Ddocker.registry.password=null -Ddocker.host.uri=null -Ddocker.host.certificates.directory=null -Dfile.encoding=UTF-8 null /docker-autodeploy.jar

Software:

  • docker version: 1.10.3
  • docker-maven-plugin version: 0.4.3
  • maven version: 3.0.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions