Skip to content

Add NetworkMode to RuntimeContainer #574

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ type RuntimeContainer struct {
Gateway string
Name string
Hostname string
NetworkMode string
Image DockerImage
Env map[string]string
Volumes map[string]Volume
Expand Down
1 change: 1 addition & 0 deletions internal/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ func (g *generator) getContainers() ([]*context.RuntimeContainer, error) {
Name: strings.TrimLeft(container.Name, "/"),
Hostname: container.Config.Hostname,
Gateway: container.NetworkSettings.Gateway,
NetworkMode: container.HostConfig.NetworkMode,
Addresses: []context.Address{},
Networks: []context.Network{},
Env: make(map[string]string),
Expand Down
3 changes: 3 additions & 0 deletions internal/generator/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ func TestGenerateFromEvents(t *testing.T) {
Cmd: []string{"/bin/sh"},
Image: "base:latest",
},
HostConfig: &docker.HostConfig{
NetworkMode: "container:d246e2c9e3d465d96359c942e91de493f6d51a01ba33900d865180d64c34ee91",
},
State: docker.State{
Running: true,
Pid: 400,
Expand Down