Skip to content

Commit 8c5c3de

Browse files
Update install_docker.sh for containerd configuration
## Summary Fixes sed regex in containerd root configuration to use correct single backslash `\?` instead of double backslash `\\?`. ## Problem The double backslash `\\?` in the sed pattern looks for a literal backslash character, not an optional `#`. This prevents the containerd root configuration from being uncommented and updated. ## Solution Changed sed pattern from `^#\\?root` to `^#\?root` to correctly match optional `#` character. ## Testing Verified on live cluster that: - Double backslash `\\?` fails: `#root = "/var/lib/containerd"` (stays commented) - Single backslash `\?` works: `root = "/opt/sagemaker/containerd/data-root"` (uncommented and updated) ## Changes - Line 84: Containerd config for `/opt/sagemaker` with correct sed - Line 101: Containerd config for `/opt/dlami/nvme` with correct sed Fixes the issue reported in PR #914.
1 parent 03c6318 commit 8c5c3de

File tree

1 file changed

+24
-1
lines changed
  • 1.architectures/5.sagemaker-hyperpod/LifecycleScripts/base-config/utils

1 file changed

+24
-1
lines changed

1.architectures/5.sagemaker-hyperpod/LifecycleScripts/base-config/utils/install_docker.sh

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ sudo usermod -aG docker ubuntu
6666
# See: https://github.com/aws-samples/awsome-distributed-training/issues/127
6767
#
6868
# Docker workdir doesn't like Lustre. Tried with storage driver overlay2, fuse-overlayfs, & vfs.
69+
# Also, containerd ships with a commented root in its default config; we need to ensure an
70+
# uncommented root that points to the fast local volume.
6971
if [[ $(mount | grep /opt/sagemaker) ]]; then
7072
cat <<EOL >> /etc/docker/daemon.json
7173
{
@@ -76,6 +78,13 @@ EOL
7678
sed -i \
7779
's|^\[Service\]$|[Service]\nEnvironment="DOCKER_TMPDIR=/opt/sagemaker/docker/tmp"|' \
7880
/usr/lib/systemd/system/docker.service
81+
82+
# Ensure containerd config exists and point its root to /opt/sagemaker
83+
if [[ ! -f /etc/containerd/config.toml ]]; then
84+
containerd config default | sudo tee /etc/containerd/config.toml >/dev/null
85+
fi
86+
sudo sed -i -e 's|^#\?root *=.*|root = "/opt/sagemaker/containerd/data-root"|' \
87+
/etc/containerd/config.toml
7988
elif [[ $(mount | grep /opt/dlami/nvme) ]]; then
8089
cat <<EOL >> /etc/docker/daemon.json
8190
{
@@ -86,7 +95,21 @@ EOL
8695
sed -i \
8796
's|^\[Service\]$|[Service]\nEnvironment="DOCKER_TMPDIR=/opt/dlami/nvme/docker/tmp"|' \
8897
/usr/lib/systemd/system/docker.service
98+
99+
# Ensure containerd config exists and point its root to /opt/dlami/nvme
100+
if [[ ! -f /etc/containerd/config.toml ]]; then
101+
containerd config default | sudo tee /etc/containerd/config.toml >/dev/null
102+
fi
103+
sudo sed -i \
104+
-e 's|^#\?root *=.*|root = "/opt/dlami/nvme/docker/containerd"|' \
105+
/etc/containerd/config.toml
89106
fi
90107

91108
systemctl daemon-reload
92-
systemctl restart docker
109+
systemctl restart docker
110+
111+
echo "
112+
###################################
113+
# END: install docker
114+
###################################
115+
"

0 commit comments

Comments
 (0)