Skip to content

Commit

Permalink
fix: map ports as exposed ports always (#237)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
  • Loading branch information
wolf31o2 authored May 25, 2024
1 parent 215ed9c commit 5858d9e
Showing 1 changed file with 14 additions and 6 deletions.
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

0 comments on commit 5858d9e

Please sign in to comment.