Skip to content

Commit 3e8bfcc

Browse files
authored
Merge pull request moby#43263 from thaJeztah/daemon_config_tweak
daemon/config: DefaultShmSize: minor tweak and improve docs
2 parents eac029c + 821b4d4 commit 3e8bfcc

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

daemon/config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ const (
3232
// maximum number of attempts that
3333
// may take place at a time for each pull when the connection is lost.
3434
DefaultDownloadAttempts = 5
35-
// DefaultShmSize is the default value for container's shm size
36-
DefaultShmSize = int64(67108864)
35+
// DefaultShmSize is the default value for container's shm size (64 MiB)
36+
DefaultShmSize int64 = 64 * 1024 * 1024
3737
// DefaultNetworkMtu is the default value for network MTU
3838
DefaultNetworkMtu = 1500
3939
// DisableNetworkBridge is the default value of the option to disable network bridge

daemon/oci_linux.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"github.com/containerd/containerd/pkg/userns"
1818
containertypes "github.com/docker/docker/api/types/container"
1919
"github.com/docker/docker/container"
20-
daemonconfig "github.com/docker/docker/daemon/config"
20+
dconfig "github.com/docker/docker/daemon/config"
2121
"github.com/docker/docker/oci"
2222
"github.com/docker/docker/oci/caps"
2323
"github.com/docker/docker/pkg/idtools"
@@ -34,7 +34,7 @@ import (
3434
"golang.org/x/sys/unix"
3535
)
3636

37-
const inContainerInitPath = "/sbin/" + daemonconfig.DefaultInitBinary
37+
const inContainerInitPath = "/sbin/" + dconfig.DefaultInitBinary
3838

3939
// WithRlimits sets the container's rlimits along with merging the daemon's rlimits
4040
func WithRlimits(daemon *Daemon, c *container.Container) coci.SpecOpts {
@@ -742,7 +742,7 @@ func WithCommonOptions(daemon *Daemon, c *container.Container) coci.SpecOpts {
742742
s.Process.Args = append([]string{inContainerInitPath, "--", c.Path}, c.Args...)
743743
path := daemon.configStore.InitPath
744744
if path == "" {
745-
path, err = exec.LookPath(daemonconfig.DefaultInitBinary)
745+
path, err = exec.LookPath(dconfig.DefaultInitBinary)
746746
if err != nil {
747747
return err
748748
}

integration-cli/docker_api_containers_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
networktypes "github.com/docker/docker/api/types/network"
2323
"github.com/docker/docker/api/types/versions"
2424
"github.com/docker/docker/client"
25+
dconfig "github.com/docker/docker/daemon/config"
2526
"github.com/docker/docker/integration-cli/cli"
2627
"github.com/docker/docker/integration-cli/cli/build"
2728
"github.com/docker/docker/pkg/ioutils"
@@ -1441,7 +1442,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *testing.T) {
14411442
func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *testing.T) {
14421443
// ShmSize is not supported on Windows
14431444
testRequires(c, DaemonIsLinux)
1444-
var defaultSHMSize int64 = 67108864
1445+
14451446
config := containertypes.Config{
14461447
Image: "busybox",
14471448
Cmd: []string{"mount"},
@@ -1457,7 +1458,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *testin
14571458
containerJSON, err := cli.ContainerInspect(context.Background(), container.ID)
14581459
assert.NilError(c, err)
14591460

1460-
assert.Equal(c, containerJSON.HostConfig.ShmSize, defaultSHMSize)
1461+
assert.Equal(c, containerJSON.HostConfig.ShmSize, dconfig.DefaultShmSize)
14611462

14621463
out, _ := dockerCmd(c, "start", "-i", containerJSON.ID)
14631464
shmRegexp := regexp.MustCompile(`shm on /dev/shm type tmpfs(.*)size=65536k`)

0 commit comments

Comments
 (0)