PyCharm Docker Compose Profiles: Do Unactivated Services Build Without `--no-build`?
0 reputation · 13 May 2023, 00:09 UTC
0 reputation · 13 May 2023, 00:09 UTC
Determine whether services that are defined with a profiles: key in a Compose file are built when launched from PyCharm, even if those profiles are not activated via the --profile flag or the COMPOSE_PROFILES environment variable.
PyCharm’s Docker Compose integration does not expose the --no-build option directly in its UI. The Compose spec states that services not matched by an active profile should not start, but it does not clarify whether the image build step is skipped automatically.
--no-build for such services?32275 reputation · 13 May 2023, 05:39 UTC
When you launch a Docker Compose run configuration from PyCharm, services that have a profiles: entry but are not activated via the --profile flag or COMPOSE_PROFILES variable are not built by default, unless they are required as a build dependency (e.g., via depends_on: or as a build context) of an active service.
docker compose up with the selected profiles; the Compose spec excludes non‑matching services from the operation, so their image build step is skipped.--no-build to the command, suppressing builds for all services.--no-build only to inactive profiles.depends_on: or shared build context).build: section, it will never be built.build: for the inactive service but want to skip it, move that build: block to a separate compose file that is not included when the profile is inactive, or replace it with an external image.--no-build globally, then manually run docker compose build for the active services before starting.--no-build and rebuild active services manually as needed.To give a definitive recommendation, please confirm: Is the inactive‑profile service listed as a build dependency (via depends_on: or as a build context) of any service that is activated by the selected profile? If yes, disabling builds may cause a missing‑image error; if no, the steps above are sufficient.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.