Skip to content

Commit

Permalink
feat: skip overlay mount checks with docker
Browse files Browse the repository at this point in the history
We need to be able to run an install with `docker run`. This checks if
we are running from docker and skips overlay mount checks if we are, as
docker creates a handful of overlay mounts by default that we can't
workaround (not easily at least).

Signed-off-by: Andrew Rynhard <andrew@rynhard.io>
  • Loading branch information
andrewrynhard authored and talos-bot committed Jun 21, 2021
1 parent b6e0231 commit 821f469
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion cmd/installer/pkg/install/manifest.go
Expand Up @@ -94,13 +94,18 @@ func NewManifest(label string, sequence runtime.Sequence, bootPartitionFound boo
}
}

skipOverlayMountsCheck, err := shouldSkipOverlayMountsCheck(sequence)
if err != nil {
return nil, err
}

manifest.Devices[opts.Disk] = Device{
Device: opts.Disk,

ResetPartitionTable: opts.Force,
Zero: opts.Zero,

SkipOverlayMountsCheck: sequence == runtime.SequenceNoop,
SkipOverlayMountsCheck: skipOverlayMountsCheck,
}

// Initialize any slices we need. Note that a boot partition is not
Expand Down Expand Up @@ -533,3 +538,20 @@ func (m *Manifest) zeroDevice(device Device) (err error) {

return bd.Close()
}

func shouldSkipOverlayMountsCheck(sequence runtime.Sequence) (bool, error) {
var skipOverlayMountsCheck bool

_, err := os.Stat("/.dockerenv")

switch {
case err == nil:
skipOverlayMountsCheck = true
case os.IsNotExist(err):
skipOverlayMountsCheck = sequence == runtime.SequenceNoop
default:
return false, fmt.Errorf("cannot determine if /.dockerenv exists: %w", err)
}

return skipOverlayMountsCheck, nil
}

0 comments on commit 821f469

Please sign in to comment.