docker/compose · error

cannot share IPC namespace with service

Error message

cannot share IPC namespace with service %s: container missing

What it means

The IPC arm of resolveSharedNamespaces: an `ipc: "service:<name>"` setting must be rewritten to container:<id> of a live container of that service. When containersByService has no entry (zero containers) for the referenced service, the IPC namespace cannot be shared and convergence fails.

Solutions

  1. Bring up the provider alongside the dependent (add depends_on or include it in the up command)
  2. Verify the provider container exists and stays running: `docker compose ps -a <provider>` and its logs
  3. As a fallback for plain /dev/shm sharing, use a tmpfs/size option or shared volume instead of service IPC sharing

Example fix

# before
services:
  shm:
    image: busybox
  app:
    ipc: "service:shm"

# after
services:
  shm:
    image: busybox
  app:
    depends_on: [shm]
    ipc: "service:shm"
Defensive patterns

Strategy: validation

Validate before calling

if name := getDependentServiceFromMode(svc.Ipc); name != "" {
    if len(containersByService[name]) == 0 {
        return fmt.Errorf("ipc service:%s has no containers", name)
    }
}

Prevention

When it happens

Trigger: `docker compose up` with `ipc: service:ipcserver` where ipcserver has no created containers — same family of failures as network_mode service: sharing: provider never started, crashed, or omitted from the selected services.

Common situations: Performance-sensitive setups sharing a shared-memory IPC sidecar (e.g. chrome/selenium, databases with /dev/shm sharing); partial `up` invocations that skip the provider; provider image pull failures in CI.

Related errors


AI-assisted analysis of docker/compose@ddc4b044b6 (2026-08-15). Data as JSON: /api/errors/e6ff6d3095bd0523. Report an issue: GitHub.

Appendix: source

Thrown at pkg/compose/convergence.go:105

		}
		service.VolumesFrom[i] = dependencies.sorted()[0].ID
	}
	return nil
}

func resolveSharedNamespaces(service *types.ServiceConfig, containersByService map[string]Containers) error {
	if name := getDependentServiceFromMode(service.NetworkMode); name != "" {
		dependencies := containersByService[name]
		if len(dependencies) == 0 {
			return fmt.Errorf("cannot share network namespace with service %s: container missing", name)
		}
		service.NetworkMode = types.ContainerPrefix + dependencies.sorted()[0].ID
	}

	if name := getDependentServiceFromMode(service.Ipc); name != "" {
		dependencies := containersByService[name]
		if len(dependencies) == 0 {
			return fmt.Errorf("cannot share IPC namespace with service %s: container missing", name)
		}
		service.Ipc = types.ContainerPrefix + dependencies.sorted()[0].ID
	}

	if name := getDependentServiceFromMode(service.Pid); name != "" {
		dependencies := containersByService[name]
		if len(dependencies) == 0 {
			return fmt.Errorf("cannot share PID namespace with service %s: container missing", name)
		}
		service.Pid = types.ContainerPrefix + dependencies.sorted()[0].ID
	}

	return nil
}

func getContainerName(projectName string, service types.ServiceConfig, number int) string {
	name := getDefaultContainerName(projectName, service.Name, strconv.Itoa(number))
	if service.ContainerName != "" {

View on GitHub (pinned to ddc4b044b6)