Skip to content

Docker compose start with selected service  #315

Closed

Description

@MCatherine1994

Hello there, I wonder if we could run the docker container based on a docker compose file, but only run the selected service inside it? like doing this command docker-compose up [service_name], is there any method can support that?

Currently we're using:

import testcontainers.compose
compose = testcontainers.compose.DockerCompose(COMPOSE_PATH)
compose.start()

But it will start all the services, but we just want to start selected services.

Thanks!!

Activity

  1. tillahoffmann commented on Apr 11, 2023

    @tillahoffmann
    Contributor

    Yes, that should be possible in principle by modifying the start function. Contributions welcome!

    def start(self) -> None:
    """
    Starts the docker compose environment.
    """
    if self.pull:
    pull_cmd = self.docker_compose_command() + ['pull']
    self._call_command(cmd=pull_cmd)
    up_cmd = self.docker_compose_command() + ['up', '-d']
    if self.build:
    up_cmd.append('--build')
    self._call_command(cmd=up_cmd)

  2. balint-backmaker commented on Apr 18, 2023

    @balint-backmaker
    Contributor

    @tillahoffmann I'd be interested in picking this up, just the matter of fitting it into my usual duties at the company I work for.

    Having said that, a simple "services" component should be a no-brainer! Expect a PR soon! :)

    EDIT:
    I guess in return I'm just curious about your review/release schedule! I couldn't find the obvious doc in the repo (like CONTRIBUTING.md or alike)
    CODEOWNERS doesn't seem to indicate an owner of the /compose iether so I'd be interested in volunteering, dependent on how your contribution guide looks like ofc. :)

  3. added
    ✅ close on merge
    on Apr 22, 2023
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

    ✅ close on merge📦 package: compose🚀 enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions