Skip to content

Commit

Permalink
add support for shm_size
Browse files Browse the repository at this point in the history
  • Loading branch information
aksiksi committed Nov 28, 2023
1 parent cb22634 commit 4c4d319
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ If a feature is missing, please feel free to [create an issue](https://github.co
| [`privileged`](https://docs.docker.com/compose/compose-file/05-services/#privileged) | ✅ |
| [`extra_hosts`](https://docs.docker.com/compose/compose-file/05-services/#extra_hosts) | ✅ |
| [`sysctls`](https://docs.docker.com/compose/compose-file/05-services/#sysctls) | ✅ |
| [`shm_size`](https://docs.docker.com/compose/compose-file/05-services/#shm_size) | ✅ |
#### [`networks`](https://docs.docker.com/compose/compose-file/06-networks/)
Expand Down
4 changes: 4 additions & 0 deletions compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ func (g *Generator) buildNixContainer(service types.ServiceConfig) (*NixContaine
c.ExtraOptions = append(c.ExtraOptions, fmt.Sprintf("--sysctl=%s=%s", name, value))
}

if service.ShmSize != 0 {
c.ExtraOptions = append(c.ExtraOptions, fmt.Sprintf("--shm-size=%d", service.ShmSize))
}

// Compose defaults to "json-file", so we'll treat _any_ "json-file" setting as a default.
// Users can override this behavior via CLI.
//
Expand Down
1 change: 1 addition & 0 deletions testdata/TestDocker_EnvFilesOnly_out.nix
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
"--network-alias=transmission"
"--network=myproject-something"
"--privileged"
"--shm-size=67108864"
"--sysctl=net.ipv6.conf.all.disable_ipv6=0"
];
};
Expand Down
1 change: 1 addition & 0 deletions testdata/TestDocker_RemoveVolumes_out.nix
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
"--network-alias=transmission"
"--network=myproject-something"
"--privileged"
"--shm-size=67108864"
"--sysctl=net.ipv6.conf.all.disable_ipv6=0"
];
};
Expand Down
1 change: 1 addition & 0 deletions testdata/TestDocker_SystemdMount_out.nix
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
"--network-alias=transmission"
"--network=myproject-something"
"--privileged"
"--shm-size=67108864"
"--sysctl=net.ipv6.conf.all.disable_ipv6=0"
];
};
Expand Down
1 change: 1 addition & 0 deletions testdata/TestDocker_WithProject_out.nix
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
"--network-alias=transmission"
"--network=myproject-something"
"--privileged"
"--shm-size=67108864"
"--sysctl=net.ipv6.conf.all.disable_ipv6=0"
];
};
Expand Down
1 change: 1 addition & 0 deletions testdata/TestDocker_out.nix
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
"--network-alias=transmission"
"--network=myproject-something"
"--privileged"
"--shm-size=67108864"
"--sysctl=net.ipv6.conf.all.disable_ipv6=0"
];
};
Expand Down
1 change: 1 addition & 0 deletions testdata/TestPodman_WithProject_out.nix
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
"--network-alias=transmission"
"--network=myproject-something:alias=my-torrent-client"
"--privileged"
"--shm-size=67108864"
"--sysctl=net.ipv6.conf.all.disable_ipv6=0"
];
};
Expand Down
1 change: 1 addition & 0 deletions testdata/TestPodman_out.nix
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
"--network-alias=transmission"
"--network=myproject-something:alias=my-torrent-client"
"--privileged"
"--shm-size=67108864"
"--sysctl=net.ipv6.conf.all.disable_ipv6=0"
];
};
Expand Down
1 change: 1 addition & 0 deletions testdata/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ services:
- "abc:93.184.216.34"
depends_on:
- sabnzbd
shm_size: 64m
environment:
TZ: ${TIMEZONE}
PUID: ${PUID}
Expand Down

0 comments on commit 4c4d319

Please sign in to comment.