'Cannot run container that build from azure pipeline with Spring boot
I tried to run a container that build from azure pipeline and I have encountered with this error below. I run it on local and it works just fine and the pipeline builded successfully.
Error message when I tried to run a container
trigger:
- azure-pipeline
pool:
vmImage: 'ubuntu-18.04'
steps:
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
goals: 'package'
- task: Maven@3
displayName: Build Docker image
inputs:
mavenPomFile: 'pom.xml'
goals: 'spring-boot:build-image'
publishJUnitResults: false
jdkVersionOption: '1.8'
- task: Docker@2
displayName: Push Docker image
inputs:
containerRegistry: 'flexible-benefit'
repository: 'hub-web-services'
command: 'push'
tags: 'latest'
If anyone want more further information please comment down below and I will edit and add more information.
Solution 1:[1]
There exists a task called the "Build and Push Image" in Azure Pipelines which can achieve the same thing as creating an image and pushing it to the container registry. All you need is to create a docker file specifying the jar location and specify the docker file path in the task. You can check online how to create a docker file, this will mostly solve your issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Hritik Nandanwar |