mirror of
https://github.com/siderolabs/talos.git
synced 2025-09-19 04:41:13 +02:00
feat: skip overlay mount checks with docker
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>
This commit is contained in:
parent
b6e02311a3
commit
821f469a1d
@ -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{
|
manifest.Devices[opts.Disk] = Device{
|
||||||
Device: opts.Disk,
|
Device: opts.Disk,
|
||||||
|
|
||||||
ResetPartitionTable: opts.Force,
|
ResetPartitionTable: opts.Force,
|
||||||
Zero: opts.Zero,
|
Zero: opts.Zero,
|
||||||
|
|
||||||
SkipOverlayMountsCheck: sequence == runtime.SequenceNoop,
|
SkipOverlayMountsCheck: skipOverlayMountsCheck,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize any slices we need. Note that a boot partition is not
|
// Initialize any slices we need. Note that a boot partition is not
|
||||||
@ -533,3 +538,20 @@ func (m *Manifest) zeroDevice(device Device) (err error) {
|
|||||||
|
|
||||||
return bd.Close()
|
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
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user