Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add captureContainersOutput per service #438

Open
mitasov-ra opened this issue Mar 22, 2024 · 1 comment
Open

Add captureContainersOutput per service #438

mitasov-ra opened this issue Mar 22, 2024 · 1 comment

Comments

@mitasov-ra
Copy link

captureContainersOutput is very useful, but when I have docker-compose with up to 10 services, this switch simply explodes my console.

I think it would be nice to have option to enable containers output only for specified services, not for all at once.

Right now I deal with this problem by controlling log levels for each container individually, but this is really time consuming

@turchinc
Copy link

turchinc commented Apr 17, 2024

was just looking for the same feature and found this +1

A possible workaround that I am using is splitting services into two files and then making them dependent: I only need output from the main compose

// https://githu b.com/avast/gradle-docker-compose-plugin
dockerCompose {
	infra {
			useComposeFiles = ['docker-compose-infra.yml']
			dockerComposeWorkingDirectory = project.file('docker')
			buildAdditionalArgs = ['--force-rm']
	}
	main{
			useComposeFiles = ['docker-compose-main.yml']
			dockerComposeWorkingDirectory = project.file('docker')
			buildAdditionalArgs = ['--force-rm']
			captureContainersOutput = true
	}
}
mainComposeUp.dependsOn ear, infraComposeUp

This also has the advantage that I can do gradle mainComposeDown without having to stop my other services which are unchanged.

You can then use an external network both compose files to ensure containers "see" each other:

networks:
  dev-network:
    external: true
services:
  db-svr: 
    image: mariadb:lts-jammy
    networks:
    - dev-network

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

No branches or pull requests

3 participants