Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: map ports as exposed ports always #237

Merged
merged 1 commit into from
May 25, 2024
Merged
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
20 changes: 14 additions & 6 deletions pkgmgr/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ func (d *DockerService) Create() error {
if err != nil {
return err
}

// Create a new PortSet to expose all ports
exposePorts := make(nat.PortSet)
for port := range tmpPorts {
exposePorts[port] = struct{}{}
}

// Set the desired user ID and group ID
userID := os.Getuid()
groupID := os.Getgid()
Expand All @@ -183,12 +190,13 @@ func (d *DockerService) Create() error {
resp, err := client.ContainerCreate(
context.Background(),
&container.Config{
Hostname: d.ContainerName,
Image: d.Image,
Entrypoint: d.Command,
Cmd: d.Args,
Env: tmpEnv[:],
User: userAndGroup,
Hostname: d.ContainerName,
Image: d.Image,
Entrypoint: d.Command,
Cmd: d.Args,
Env: tmpEnv[:],
User: userAndGroup,
ExposedPorts: exposePorts,
},
&container.HostConfig{
RestartPolicy: container.RestartPolicy{
Expand Down