Search code examples
dockerargumentscontainersazure-service-fabric

How to specify commandline arguments to a docker container in Azure Service Fabric


I've a docker image wiremock.net-nano which accepts additional commandline parameters like --Port and --AdminUsername.

The normal docker commandline looks like:

docker run --rm -p 9091:80 sheyenrath/wiremock.net-nano --ReadStaticMappings true --AdminUsername x --AdminPassword y --RequestLogExpirationDuration 24


But how can I configure these parameters in Azure Service Fabric?
The ServiceManifest.xml file defines only the image name (<ImageName>sheyenrath/wiremock.net-nano</ImageName>) and port forwarding (<Endpoint Name="WireMock_ContainerTypeEndpoint" Port="9091" />).


Solution

  • If I am not mistaken the <ContainerHostEntryPointType>/<Commands> in the element is what you are looking for.

    As per ServiceManifest.xml schema:

    Pass a comma delimited list of commands to the container.

    The schema excerpt:

    <xs:complexType xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/2011/01/fabric" name="ContainerHostEntryPointType">
    <xs:sequence>
      <!--container image name-->
      <xs:element name="ImageName" type="xs:string">
        <xs:annotation>
          <xs:documentation>The repo and image on https://hub.docker.com or Azure Container Registry.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <!--comma delimited list of commands for container-->
      <xs:element name="Commands" type="xs:string" minOccurs="0" maxOccurs="1">
        <xs:annotation>
          <xs:documentation>Pass a comma delimited list of commands to the container.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="EntryPoint" type="xs:string" minOccurs="0" maxOccurs="1"/>
      <xs:element name="FromSource" type="xs:string" minOccurs="0" maxOccurs="1"/>
    </xs:sequence>