summaryrefslogtreecommitdiff
path: root/start-container-docker.sh
diff options
context:
space:
mode:
Diffstat (limited to 'start-container-docker.sh')
-rwxr-xr-xstart-container-docker.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/start-container-docker.sh b/start-container-docker.sh
index 5b716aff..c4f6dc53 100755
--- a/start-container-docker.sh
+++ b/start-container-docker.sh
@@ -272,6 +272,15 @@ for mount in "${volume_mounts[@]}"; do
bind_mounts_opt=("${bind_mounts_opt[@]}" "-v" "$mount")
done
+# Give access to all CPUs to container.
+# This happens by default on most machines, but on machines that can put
+# unused cores offline (TK1s and TX1s) it can happen that docker cpuset
+# cgroup gets configured to use only a subset of cores. If this happens,
+# then we have a bug in our HW scripts, and here is the best place
+# to detect this problem -- docker run will fail if it can't provide
+# any of the CPUs to the new container.
+cpuset_opt="--cpuset-cpus 0-$(($nproc - 1))"
+
echo "DEBUG: starting docker on $session_host from $(hostname), date $(date)"
docker_run=($DOCKER run --name $session_name -dtP \
"${bind_mounts_opt[@]}" \
@@ -279,6 +288,7 @@ docker_run=($DOCKER run --name $session_name -dtP \
--memory=${memory}M \
--pids-limit=${pids} \
--cpu-shares=${cpus} \
+ $cpuset_opt \
${docker_opts} \
$image) || ssh_error $?
echo "${docker_run[@]}"