fix(container): Fix the problem that a container cannot create a read… (#8095)

Refs #8074
This commit is contained in:
ssongliu 2025-03-07 15:44:59 +08:00 committed by GitHub
parent 05f72e9dcf
commit 766beae4e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1195,9 +1195,10 @@ func loadConfigInfo(isCreate bool, req dto.ContainerOperate, oldContainer *types
for _, volume := range req.Volumes {
if volume.Type == "volume" {
hostConf.Mounts = append(hostConf.Mounts, mount.Mount{
Type: mount.Type(volume.Type),
Source: volume.SourceDir,
Target: volume.ContainerDir,
Type: mount.Type(volume.Type),
Source: volume.SourceDir,
Target: volume.ContainerDir,
ReadOnly: volume.Mode == "ro",
})
config.Volumes[volume.ContainerDir] = struct{}{}
} else {