Skip to content

Docker remains stopped after persistent data-disk provisioning during headless boot #1637

Description

@CFBancroft

I originally reported this as a follow-up comment on Lima PR #5489 while testing headless autostart. After isolating the behavior further, this appears to be a Colima persistent data-disk provisioning issue, so I am opening it here for proper tracking.

Environment

  • 2018 Intel Mac mini (Macmini8,1)
  • Intel x86_64
  • macOS Sequoia 15.7.9
  • Colima 0.10.3
  • Docker runtime
  • Lima VM started headlessly by a LaunchDaemon
  • Dedicated service user: containerserver

The Lima LIMA_HOME autostart problem was handled separately by lima-vm/lima#5489.

After that problem was resolved, Lima successfully started the Colima VM at boot, but Docker and restart-policy containers still did not become available until the first Docker API access.

Observed behavior

During a true headless boot:

  1. Lima starts the Colima VM successfully.
  2. Docker starts inside the VM.
  3. Colima persistent data-disk provisioning runs:
    • systemctl stop docker.service
    • systemctl stop containerd.service
  4. Colima bind-mounts the persistent runtime directories.
  5. Provisioning completes without explicitly starting Docker again.
  6. docker.service remains inactive/dead.
  7. docker.socket remains available.
  8. The first Docker API access, such as docker ps, socket-activates Docker.
  9. Restart-policy containers then start.

Before the first Docker API access, a DokuWiki container with
restart: unless-stopped was not reachable on port 5555.

This means the Lima VM itself is awake and running, but the Docker service does not return automatically after Colima's persistent data-disk provisioning.

Source investigation

In the current Colima source, Docker's DataDisk() includes:

PreMount: []string{
    "systemctl stop docker.service",
    "systemctl stop containerd.service",
},

I did not find a corresponding post-mount start of docker.service.

The Lima disk-mount provisioning runs the PreMount commands and then performs the persistent bind mounts, but there was no post-mount stage to start Docker again.

Experimental fix tested

I added a generic PostMount field to DataDisk:

type DataDisk struct {
    Dirs      []DiskDir
    PreMount  []string
    PostMount []string
    FSType    string
}

For the Docker data disk:

PostMount: []string{
    "systemctl start docker.service",
},

I then extended the Lima disk provisioning in Colima to append the PostMount commands after all persistent bind mounts.

The resulting provisioning order is:

stop Docker/containerdmount persistent runtime directoriesstart Docker
Test result

I built the modified Colima natively on the Intel Mac:

colima version v0.10.3-19-gc3a5f91
git commit: c3a5f9184d83a197184f897a9f07eb3c01b3bc88

The real headless containerserver Colima instance was regenerated with the modified binary.

The resulting lima.yaml contained:

script: systemctl start docker.service

after the persistent bind mounts.

I then tested:

normal rebootPASS
reboot with no GUI loginPASS
SSH-initiated rebootPASS
physical monitor disconnectedPASS
no docker ps or other Docker API wake-upPASS
DokuWiki container on port 5555 returned automaticallyPASS

This changed the behavior from:

VM runningDocker inactive until first Docker API access

to:

VM runningpersistent mounts completeDocker startsrestart-policy containers start automatically
Question

Would a generic PostMount stage on DataDisk be an appropriate way to handle this, or would the Colima maintainers prefer Docker to be restarted through a more Docker-specific mechanism after the persistent runtime directories are mounted?

I have kept the working local patch unchanged for further testing if useful.

Tested-by: CFBancroft2018 Intel Mac mini (x86_64)

Assisted-by: ChatGPT (GPT-5.6 Sol)

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions