mirror of https://github.com/docker/cli.git
Add support for extra_hosts in composefile v3
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
356421b7da
commit
84a795bf05
|
@ -498,6 +498,7 @@ func convertService(
|
||||||
Command: service.Entrypoint,
|
Command: service.Entrypoint,
|
||||||
Args: service.Command,
|
Args: service.Command,
|
||||||
Hostname: service.Hostname,
|
Hostname: service.Hostname,
|
||||||
|
Hosts: convertExtraHosts(service.ExtraHosts),
|
||||||
Env: convertEnvironment(service.Environment),
|
Env: convertEnvironment(service.Environment),
|
||||||
Labels: getStackLabels(namespace.name, service.Labels),
|
Labels: getStackLabels(namespace.name, service.Labels),
|
||||||
Dir: service.WorkingDir,
|
Dir: service.WorkingDir,
|
||||||
|
@ -521,6 +522,14 @@ func convertService(
|
||||||
return serviceSpec, nil
|
return serviceSpec, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func convertExtraHosts(extraHosts map[string]string) []string {
|
||||||
|
hosts := []string{}
|
||||||
|
for host, ip := range extraHosts {
|
||||||
|
hosts = append(hosts, fmt.Sprintf("%s %s", host, ip))
|
||||||
|
}
|
||||||
|
return hosts
|
||||||
|
}
|
||||||
|
|
||||||
func convertRestartPolicy(restart string, source *composetypes.RestartPolicy) (*swarm.RestartPolicy, error) {
|
func convertRestartPolicy(restart string, source *composetypes.RestartPolicy) (*swarm.RestartPolicy, error) {
|
||||||
// TODO: log if restart is being ignored
|
// TODO: log if restart is being ignored
|
||||||
if source == nil {
|
if source == nil {
|
||||||
|
|
Loading…
Reference in New Issue