mirror of
https://github.com/docker/compose.git
synced 2025-07-12 16:24:32 +02:00
Merge pull request #897 from docker/volume_conflict
Don't panic on bind mount
This commit is contained in:
commit
949f0ce62e
@ -385,13 +385,13 @@ func (b *ecsAPIService) createTaskRole(project *types.Project, service types.Ser
|
|||||||
rolePolicies := []iam.Role_Policy{}
|
rolePolicies := []iam.Role_Policy{}
|
||||||
if roles, ok := service.Extensions[extensionRole]; ok {
|
if roles, ok := service.Extensions[extensionRole]; ok {
|
||||||
rolePolicies = append(rolePolicies, iam.Role_Policy{
|
rolePolicies = append(rolePolicies, iam.Role_Policy{
|
||||||
PolicyName: fmt.Sprintf("%s%sPolicy", normalizeResourceName(project.Name), normalizeResourceName(service.Name)),
|
PolicyName: fmt.Sprintf("%sPolicy", normalizeResourceName(service.Name)),
|
||||||
PolicyDocument: roles,
|
PolicyDocument: roles,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
for _, vol := range service.Volumes {
|
for _, vol := range service.Volumes {
|
||||||
rolePolicies = append(rolePolicies, iam.Role_Policy{
|
rolePolicies = append(rolePolicies, iam.Role_Policy{
|
||||||
PolicyName: fmt.Sprintf("%s%sVolumeMountPolicy", normalizeResourceName(project.Name), normalizeResourceName(service.Name)),
|
PolicyName: fmt.Sprintf("%s%sVolumeMountPolicy", normalizeResourceName(service.Name), normalizeResourceName(vol.Source)),
|
||||||
PolicyDocument: volumeMountPolicyDocument(vol.Source, resources.filesystems[vol.Source].ARN()),
|
PolicyDocument: volumeMountPolicyDocument(vol.Source, resources.filesystems[vol.Source].ARN()),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,10 @@ import (
|
|||||||
|
|
||||||
func (b *ecsAPIService) checkCompatibility(project *types.Project) error {
|
func (b *ecsAPIService) checkCompatibility(project *types.Project) error {
|
||||||
var checker compatibility.Checker = &fargateCompatibilityChecker{
|
var checker compatibility.Checker = &fargateCompatibilityChecker{
|
||||||
compatibility.AllowList{
|
AllowList: compatibility.AllowList{
|
||||||
Supported: compatibleComposeAttributes,
|
Supported: compatibleComposeAttributes,
|
||||||
},
|
},
|
||||||
|
projet: project,
|
||||||
}
|
}
|
||||||
compatibility.Check(project, checker)
|
compatibility.Check(project, checker)
|
||||||
for _, err := range checker.Errors() {
|
for _, err := range checker.Errors() {
|
||||||
@ -46,6 +47,7 @@ func (b *ecsAPIService) checkCompatibility(project *types.Project) error {
|
|||||||
|
|
||||||
type fargateCompatibilityChecker struct {
|
type fargateCompatibilityChecker struct {
|
||||||
compatibility.AllowList
|
compatibility.AllowList
|
||||||
|
projet *types.Project
|
||||||
}
|
}
|
||||||
|
|
||||||
var compatibleComposeAttributes = []string{
|
var compatibleComposeAttributes = []string{
|
||||||
@ -91,7 +93,6 @@ var compatibleComposeAttributes = []string{
|
|||||||
"services.user",
|
"services.user",
|
||||||
"services.volumes",
|
"services.volumes",
|
||||||
"services.volumes.read_only",
|
"services.volumes.read_only",
|
||||||
"services.volumes.source",
|
|
||||||
"services.volumes.target",
|
"services.volumes.target",
|
||||||
"services.working_dir",
|
"services.working_dir",
|
||||||
"secrets.external",
|
"secrets.external",
|
||||||
@ -120,6 +121,15 @@ func (c *fargateCompatibilityChecker) CheckPortsPublished(p *types.ServicePortCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *fargateCompatibilityChecker) CheckVolumesSource(config *types.ServiceVolumeConfig) {
|
||||||
|
if config.Type == types.VolumeTypeBind {
|
||||||
|
c.Incompatible("ECS Fargate does not support bind mounts from host")
|
||||||
|
}
|
||||||
|
if config.Type == types.VolumeTypeTmpfs {
|
||||||
|
c.Incompatible("ECS Fargate does not support tmpfs")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (c *fargateCompatibilityChecker) CheckCapAdd(service *types.ServiceConfig) {
|
func (c *fargateCompatibilityChecker) CheckCapAdd(service *types.ServiceConfig) {
|
||||||
add := []string{}
|
add := []string{}
|
||||||
for _, cap := range service.CapAdd {
|
for _, cap := range service.CapAdd {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user