Skip to content

Error deploy stack with external network #267

Description

@alex-labuta

Exception when trying to deploy stack from exists compose file (correctly started from console command docker stack deploy)
from groovy with command:

def deployConfig = new DeployConfigReader(dockerClient).loadCompose(stackName, new FileInputStream(composerPath), workingDir,System.getenv());

Output messages:

[main] INFO de.gesellix.docker.client.DockerClientImpl - using docker at 'unix:///var/run/docker.sock'
[main] INFO de.gesellix.docker.compose.ComposeFileReader - composeContent: {version=3.9, services={xmdb={image=xmdb, environment={POSTGRES_USER=postgres, POSTGRES_PASSWORD=secret, PGDATA=/var/lib/postgresql/data/pgdata}, ports=[6012:5432], networks=[xmnet-zh], volumes=[/opt/containers/xm/zh:/var/lib/postgresql/data], deploy={replicas=1}}, xmapp={depends_on=[xmdb], image=xmapp, ports=[9012:8080], networks=[xmnet-zh, ingress-routing], deploy={replicas=1, labels={ingress.host=zh.xm.local, ingress.port=8080}}}}, networks={xmnet-zh=null, ingress-routing={external=true}}}}
[main] INFO de.gesellix.docker.client.stack.DeployConfigReader - composeContent: ComposeConfig(version=3.9, services={xmapp=StackService(build=null, capAdd=null, capDrop=null, cgroupParent=null, command=null, configs=null, containerName=null, dependsOn=[xmdb], deploy=Deploy(mode=null, replicas=1, labels=Labels(entries={ingress.host=zh.xm.local, ingress.port=8080}), updateConfig=null, resources=null, restartPolicy=null, placement=null, endpointMode=null, maxReplicasPerNode=null), devices=null, dns=null, dnsSearch=null, domainname=null, entrypoint=Entrypoint(parts=[]), envFile=null, environment=Environment(entries={}), expose=null, externalLinks=null, extraHosts=null, healthcheck=null, hostname=null, image=xmapp, ipc=null, labels=null, links=null, logging=null, macAddress=null, networkMode=null, networks={xmnet-zh=null, ingress-routing=null}, pid=null, ports=PortConfigs(portConfigs=[PortConfig(mode=ingress, target=8080, published=9012, protocol=tcp)]), privileged=null, readOnly=null, restart=null, securityOpt=null, shmSize=null, secrets=null, sysctls=null, stdinOpen=null, stopGracePeriod=null, stopSignal=null, tmpfs=null, tty=null, ulimits=null, user=null, usernsMode=null, volumes=null, workingDir=null), xmdb=StackService(build=null, capAdd=null, capDrop=null, cgroupParent=null, command=null, configs=null, containerName=null, dependsOn=null, deploy=Deploy(mode=null, replicas=1, labels=null, updateConfig=null, resources=null, restartPolicy=null, placement=null, endpointMode=null, maxReplicasPerNode=null), devices=null, dns=null, dnsSearch=null, domainname=null, entrypoint=Entrypoint(parts=[]), envFile=null, environment=Environment(entries={POSTGRES_USER=postgres, POSTGRES_PASSWORD=GhbdtnVbh, PGDATA=/var/lib/postgresql/data/pgdata}), expose=null, externalLinks=null, extraHosts=null, healthcheck=null, hostname=null, image=xmdb, ipc=null, labels=null, links=null, logging=null, macAddress=null, networkMode=null, networks={xmnet-zh=null}, pid=null, ports=PortConfigs(portConfigs=[PortConfig(mode=ingress, target=5432, published=6012, protocol=tcp)]), privileged=null, readOnly=null, restart=null, securityOpt=null, shmSize=null, secrets=null, sysctls=null, stdinOpen=null, stopGracePeriod=null, stopSignal=null, tmpfs=null, tty=null, ulimits=null, user=null, usernsMode=null, volumes=[ServiceVolume(type=bind, source=/opt/containers/xm/zh, target=/var/lib/postgresql/data, readOnly=false, consistency=, bind=null, volume=null)], workingDir=null)}, networks={xmnet-zh=null, ingress-routing=StackNetwork(driver=null, driverOpts=DriverOpts(options={}), ipam=null, external=External(external=true, name=), internal=null, attachable=false, labels=null)}, volumes=null, secrets=null, configs=null)}
[main] INFO de.gesellix.docker.client.stack.DeployConfigReader - service network names: [xmnet-zh, ingress-routing]
[main] INFO de.gesellix.docker.client.stack.DeployConfigReader - network configs: [xmnet-zh:NetworkCreateRequest(name=xmnet-zh, checkDuplicate=true, driver=overlay, internal=null, attachable=null, ingress=null, IPAM=null, enableIPv6=null, options=null, labels={com.docker.stack.namespace=zh})]
[main] INFO de.gesellix.docker.client.stack.DeployConfigReader - external networks: [ingress-routing]
[main] INFO de.gesellix.docker.client.system.ManageSystemClient - docker version
[main] INFO de.gesellix.docker.client.system.ManageSystemClient - docker version
Caught: java.lang.AbstractMethodError: de.gesellix.docker.client.stack.DeployConfigReader.getProperty(Ljava/lang/String;)Ljava/lang/Object;
java.lang.AbstractMethodError: de.gesellix.docker.client.stack.DeployConfigReader.getProperty(Ljava/lang/String;)Ljava/lang/Object;
at de.gesellix.docker.client.stack.DeployConfigReader$_validateExternalNetworks_closure20.doCall(DeployConfigReader.groovy:824)
at de.gesellix.docker.client.stack.DeployConfigReader.validateExternalNetworks(DeployConfigReader.groovy:817)
at de.gesellix.docker.client.stack.DeployConfigReader$validateExternalNetworks$1.callCurrent(Unknown Source)
at de.gesellix.docker.client.stack.DeployConfigReader.networks(DeployConfigReader.groovy:773)
at de.gesellix.docker.client.stack.DeployConfigReader$networks$0.callCurrent(Unknown Source)
at de.gesellix.docker.client.stack.DeployConfigReader.loadCompose(DeployConfigReader.groovy:107)
at de.gesellix.docker.client.stack.DeployConfigReader$loadCompose.call(Unknown Source)

Groovy 2.5.16
JDK8

Libraries file list:
docker-client-2022-02-01T12-00-00.jar
docker-filesocket-2022-02-22T19-32-00.jar
junixsocket-common-2.4.0.jar
kotlin-logging-jvm-2.1.21.jar
kotlin-stdlib-common-1.6.10.jar
moshi-kotlin-1.12.0.jar
okio-jvm-3.0.0.jar
slf4j-api-1.7.32.jar
docker-compose-2022-02-23T22-16-00.jar
docker-remote-api-client-2022-02-23T13-45-00.jar
junixsocket-native-common-2.4.0.jar
kotlin-reflect-1.6.10.jar
kotlin-stdlib-jdk8-1.6.10.jar
okhttp-4.9.3.jar
postgresql-42.2.18.jar
slf4j-simple-1.7.32.jar
docker-engine-2022-02-22T23-12-00.jar
docker-remote-api-model-1-41-2022-02-23T11-47-00.jar
kotlin-logging-2.1.21.jar
kotlin-stdlib-1.6.10.jar
moshi-1.12.0.jar
okio-3.0.0.jar
re2j-1.6.jar
snakeyaml-1.30.jar

Also docker-client cant parse external network alias like:

networks:
   proxy:
      external: true
      name: ingress-routing

only direct naming as:

networks:
   ingress-routing:
      external: true

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions