Make container memory limit configurable

This commit is contained in:
Marcos Lilljedahl
2017-09-18 17:20:18 -03:00
parent 86f27ee10d
commit a268ad6988
3 changed files with 10 additions and 3 deletions

View File

@@ -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

View File

@@ -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/*

View File

@@ -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
}