Skip to content

Commit

Permalink
Add extra host to start command (flyteorg#369)
Browse files Browse the repository at this point in the history
* Add extra host to start command

Signed-off-by: Kevin Su <pingsutw@apache.org>

* Fix tests

Signed-off-by: Kevin Su <pingsutw@apache.org>

* Fix tests

Signed-off-by: Kevin Su <pingsutw@apache.org>

* Make generate

Signed-off-by: Kevin Su <pingsutw@apache.org>

* update

Signed-off-by: Kevin Su <pingsutw@apache.org>

Signed-off-by: Kevin Su <pingsutw@apache.org>
  • Loading branch information
pingsutw authored and austin362667 committed May 7, 2024
1 parent e68672b commit d528af1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions flytectl/pkg/docker/docker_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var (
}
StdWriterPrefixLen = 8
StartingBufLen = 32*1024 + StdWriterPrefixLen + 1
ExtraHosts = []string{"host.docker.internal:127.0.0.1"}
)

// GetDockerClient will returns the docker client
Expand Down Expand Up @@ -237,6 +238,7 @@ func StartContainer(ctx context.Context, cli Docker, volumes []mount.Mount, expo
Mounts: volumes,
PortBindings: portBindings,
Privileged: true,
ExtraHosts: ExtraHosts, // add it because linux machine doesn't have this host name by default
}, nil,
nil, name)

Expand Down
4 changes: 4 additions & 0 deletions flytectl/pkg/docker/docker_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func TestStartContainer(t *testing.T) {
Mounts: Volumes,
PortBindings: p2,
Privileged: true,
ExtraHosts: ExtraHosts,
}, nil, nil, mock.Anything).Return(container.ContainerCreateCreatedBody{
ID: "Hello",
}, nil)
Expand Down Expand Up @@ -185,6 +186,7 @@ func TestStartContainer(t *testing.T) {
Mounts: Volumes,
PortBindings: p2,
Privileged: true,
ExtraHosts: ExtraHosts,
}, nil, nil, mock.Anything).Return(container.ContainerCreateCreatedBody{
ID: "Hello",
}, nil)
Expand All @@ -211,6 +213,7 @@ func TestStartContainer(t *testing.T) {
Mounts: Volumes,
PortBindings: p2,
Privileged: true,
ExtraHosts: ExtraHosts,
}, nil, nil, mock.Anything).Return(container.ContainerCreateCreatedBody{
ID: "",
}, fmt.Errorf("error"))
Expand All @@ -236,6 +239,7 @@ func TestStartContainer(t *testing.T) {
Mounts: Volumes,
PortBindings: p2,
Privileged: true,
ExtraHosts: ExtraHosts,
}, nil, nil, mock.Anything).Return(container.ContainerCreateCreatedBody{
ID: "Hello",
}, nil)
Expand Down

0 comments on commit d528af1

Please sign in to comment.