forked from LaconicNetwork/kompose
Fix container_name set error
This commit is contained in:
parent
cd7c8a3d9a
commit
e74c12e452
@ -380,7 +380,7 @@ func (k *Kubernetes) UpdateKubernetesObjects(name string, service kobject.Servic
|
||||
// fillTemplate fills the pod template with the value calculated from config
|
||||
fillTemplate := func(template *api.PodTemplateSpec) error {
|
||||
if len(service.ContainerName) > 0 {
|
||||
template.Spec.Containers[0].Name = service.ContainerName
|
||||
template.Spec.Containers[0].Name = FormatContainerName(service.ContainerName)
|
||||
}
|
||||
template.Spec.Containers[0].Env = envs
|
||||
template.Spec.Containers[0].Command = service.Command
|
||||
@ -650,3 +650,10 @@ func FormatFileName(name string) string {
|
||||
envName = strings.Replace(envName, "_", "-", -1)
|
||||
return envName
|
||||
}
|
||||
|
||||
//FormatContainerName format Container name
|
||||
func FormatContainerName(name string) string {
|
||||
name = strings.Replace(name, "_", "-", -1)
|
||||
return name
|
||||
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ services:
|
||||
command: bundle exec thin -p 3000
|
||||
# command: ["bundle", "exec", "thin", "-p", "3000"]
|
||||
|
||||
container_name: my-web-container
|
||||
container_name: my_web-container
|
||||
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
Loading…
Reference in New Issue
Block a user