When running docker run --rm --cpus 2 ubuntu in dstack CVM, it fails with an error:
docker: Error response from daemon: Range of CPUs is from 0.01 to 1.00, as there are only 1 CPUs available.
This is because we have pinned dockerd to only one CPU in Dstack-TEE/meta-dstack#13.
It is unclear what the better solution might be.
Workaround (v0.5.6+)
Add the following to your pre_launch_script to enable --cpus N:
mkdir -p /etc/systemd/system/docker.service.d/
cat > /etc/systemd/system/docker.service.d/override.conf << 'EOF'
[Service]
CPUAffinity=
EOF
systemctl daemon-reload
systemctl restart docker
Note: This removes the CPU pinning optimization, which may make docker pull ~2.7x slower due to TDX IPI overhead. See comments below for a dynamic cpuset switching approach that preserves fast pulls.
When running
docker run --rm --cpus 2 ubuntuin dstack CVM, it fails with an error:This is because we have pinned dockerd to only one CPU in Dstack-TEE/meta-dstack#13.
It is unclear what the better solution might be.
Workaround (v0.5.6+)
Add the following to your
pre_launch_scriptto enable--cpus N: