Skip to content

Commit

Permalink
Make container memory limit configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosnils committed Sep 18, 2017
1 parent 86f27ee commit a268ad6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,13 @@ func (d *docker) CreateContainer(opts CreateContainerOpts) error {
}
}
h.Resources.PidsLimit = pidsLimit
h.Resources.Memory = 4092 * Megabyte

if memLimit := os.Getenv("MAX_MEMORY_MB"); memLimit != "" {
if i, err := strconv.Atoi(memLimit); err == nil {
h.Resources.Memory = int64(i) * Megabyte
}
}

t := true
h.Resources.OomKillDisable = &t

Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/dind/Dockerfile.dind-ee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG VERSION=franela/docker:17.06.2-dind-ubuntu
FROM ${VERSION}

RUN apt-get update \
&& apt-get install -y git tmux apache2-utils vim curl zfs jq bash-completion \
&& apt-get install -y git tmux apache2-utils vim curl jq bash-completion \
&& rm -rf /var/lib/apt/lists/*


Expand Down
3 changes: 2 additions & 1 deletion dockerfiles/dind/ucp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ function wait_for_url {
}

function deploy_ucp {
wait_for_url "http://localhost:2375"
wait_for_url "https://localhost:2376"
docker run --rm --name ucp \
-v /var/run/docker.sock:/var/run/docker.sock \
docker/ucp:2.2.3 install --force-insecure-tcp \
--san *.direct.${PWD_HOST_FQDN} \
--license $(cat $HOME/workshop.lic) \
--swarm-port 2375 \
--admin-username admin \
--admin-password admin1234
}
Expand Down

0 comments on commit a268ad6

Please sign in to comment.