C
C#2w ago
Alexicon

Strange seemingly new behavior of docker-compose with dot net C# solution

I have a solution with multiple C# projects in it. I have a docker-compose.yml which up until today worked. Now however, when I attempt to build this solution in Azure DevOps with docker it is giving me the error
##[error]invalid project name "My.Solution": must consist only of lowercase alphanumeric characters, hyphens, and underscores as well as start with a letter or number
##[error]invalid project name "My.Solution": must consist only of lowercase alphanumeric characters, hyphens, and underscores as well as start with a letter or number
Surly I do not need to rename all of my actual C# projects to be all lowercase and remove the periods? That seems ridiculous considering I believe it is C# convention to have projects be capitalized. Additionally, this worked just the other day, I must have made a change somewhere or something for this to happen. I have already attempted to use
name: “my_solution”
name: “my_solution”
In the docker-compose.yml but it seems to have no effect. Any insight would be appreciated since google is giving me nothing. Here is what my docker-compose.yml looks like:
version: '3.4'
name: "my_solution" #Was not originally here but added hoping it would fix this issue

services:
myproject-1:
image: ${REGISTRY:-mysolution}/my-solution/myproject-1:${TAG:-latest}
build:
context: .
dockerfile: ./My.Solution.MyProject1/Dockerfile

myproject-2:
image: ${REGISTRY:-mysolution}/my-solution/myproject-2:${TAG:-latest}
build:
context: .
dockerfile: ./My.Solution.MyProject2/Dockerfile

myproject-3:
image: ${REGISTRY:-mysolution}/my-solution/myproject-3:${TAG:-latest}
build:
context: .
dockerfile: ./My.Solution.MyProject3/Dockerfile
version: '3.4'
name: "my_solution" #Was not originally here but added hoping it would fix this issue

services:
myproject-1:
image: ${REGISTRY:-mysolution}/my-solution/myproject-1:${TAG:-latest}
build:
context: .
dockerfile: ./My.Solution.MyProject1/Dockerfile

myproject-2:
image: ${REGISTRY:-mysolution}/my-solution/myproject-2:${TAG:-latest}
build:
context: .
dockerfile: ./My.Solution.MyProject2/Dockerfile

myproject-3:
image: ${REGISTRY:-mysolution}/my-solution/myproject-3:${TAG:-latest}
build:
context: .
dockerfile: ./My.Solution.MyProject3/Dockerfile
5 Replies
Salman
Salman2w ago
compose file looks fine to me and name isn't necessary as well. Not sure what's causing the problem
qqdev
qqdev2w ago
Can you show the Azure DevOps scripts?
Alexicon
Alexicon2w ago
Here is the relavant task that is failing with the error in my post:
jobs:
- job: ${{parameters.jobName}}
displayName: 'Build Docker container'
...

steps:
- ...

- task: DockerCompose@0
displayName: docker-compose build my-solution
inputs:
azureSubscription: ...
azureContainerRegistry: ...
dockerComposeFile: 'docker-compose.yml'
dockerComposeFileArgs: |
TAG=1.0.$(Build.BuildId)
REGISTRY=$(registryEndpoint)
dockerComposeCommand: 'build my-solution'

- ...
jobs:
- job: ${{parameters.jobName}}
displayName: 'Build Docker container'
...

steps:
- ...

- task: DockerCompose@0
displayName: docker-compose build my-solution
inputs:
azureSubscription: ...
azureContainerRegistry: ...
dockerComposeFile: 'docker-compose.yml'
dockerComposeFileArgs: |
TAG=1.0.$(Build.BuildId)
REGISTRY=$(registryEndpoint)
dockerComposeCommand: 'build my-solution'

- ...
qqdev
qqdev2w ago
Are you sure that docker compose command is correct? Especially the "my-solution" part On my phone rn so can’t really check :when:
Unknown User
Unknown User2w ago
Message Not Public
Sign In & Join Server To View