@@ -59,12 +59,7 @@ func (gui *Gui) getProjectPanel() *panels.SideListPanel[*commands.Project] {
5959 return gui .renderContainersAndServices ()
6060 },
6161 Hide : func () bool {
62- // Only show the project panel when we are inside a docker-compose
63- // project directory. When launched outside of a compose project
64- // there is no meaningful local project to display, so we hide the
65- // panel and let the containers panel show all containers in a flat
66- // list (matching the behaviour from before v0.25).
67- return ! gui .DockerCommand .InDockerComposeProject
62+ return ! gui .DockerCommand .IsProjectScoped ()
6863 },
6964 }
7065}
@@ -99,18 +94,19 @@ func (gui *Gui) refreshProject() error {
9994}
10095
10196// getDiscoveredProjects returns all docker compose projects by examining container labels.
102- // The local project (from docker-compose.yml in the current directory) is included if
103- // it has running containers or if InDockerComposeProject is true.
97+ // The local project (from docker-compose.yml in the current directory, or from -p) is
98+ // included even when it has no running containers, so the user always sees the project
99+ // they explicitly scoped to.
104100func (gui * Gui ) getDiscoveredProjects () []* commands.Project {
105101 containers := gui .Panels .Containers .List .GetAllItems ()
106102 projectNames := gui .DockerCommand .GetProjectNames (containers )
107103
108- // If we're in a docker compose project but it has no running containers,
109- // still include it. We don't fall back to the directory name here to avoid
104+ // If we're scoped to a project but it has no running containers, still
105+ // include it. We don't fall back to the directory name here to avoid
110106 // briefly flashing the wrong project name on startup.
111107 localName := gui .DockerCommand .LocalProjectName
112108
113- if gui .DockerCommand .InDockerComposeProject && localName != "" {
109+ if gui .DockerCommand .IsProjectScoped () && localName != "" {
114110 found := false
115111 for _ , name := range projectNames {
116112 if name == localName {
@@ -195,6 +191,11 @@ func (gui *Gui) renderAllLogs(project *commands.Project) tasks.TaskFunc {
195191}
196192
197193func (gui * Gui ) renderDockerComposeConfig (project * commands.Project ) tasks.TaskFunc {
194+ if ! gui .DockerCommand .InDockerComposeProject {
195+ return gui .NewSimpleRenderStringTask (func () string {
196+ return "Compose config is only available when launched from a docker-compose project directory"
197+ })
198+ }
198199 if project != nil && project .Name != gui .DockerCommand .LocalProjectName {
199200 return gui .NewSimpleRenderStringTask (func () string {
200201 return "Compose config is not available for non-local projects"
0 commit comments