Skip to content

Commit 80c4d34

Browse files
committed
Add support to set the host name
1 parent 81c6355 commit 80c4d34

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

examples/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
redis:
22
image: redis:2.8
3+
hostname: core
34
ports:
45
- 6379
56

main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ fi
3333
--restart=always \
3434
-d \
3535
--name {{.Service.Name}}_1 \
36+
{{if .Service.HostName}}--hostname={{.Service.HostName}} {{end}} \
3637
{{range .Service.Volumes}}-v {{.}} {{end}} \
3738
{{range .Service.Links}}--link {{.}} {{end}} \
3839
{{range $key, $value := .Service.Environment}}-e {{$key}}="{{$value}}" {{end}} \
@@ -50,6 +51,7 @@ type ScriptDataTemplate struct {
5051
// Service has the same structure used by docker-compose.yml
5152
type Service struct {
5253
Name string
54+
HostName string
5355
Image string
5456
Ports []string
5557
Volumes []string

0 commit comments

Comments
 (0)