Skip to content

Commit fdb3c57

Browse files
authored
Merge pull request #124 from dockersamples/fix-credential-setup
Add entrypoint script to copy creds file, rather than using symlink
2 parents 4949150 + b44b18f commit fdb3c57

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

components/configurator/setup.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ copy_docker_credentials() {
7878

7979
if [ -f /run/secrets/docker/config.json ]; then
8080
cp /run/secrets/docker/config.json /docker-creds/config.json
81+
echo "✅ Docker credentials copied successfully"
8182
else
8283
echo "⚠️ No Docker credentials found to copy"
8384
fi

components/workspace/base/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ ENV TESTCONTAINERS_HOST_OVERRIDE=localhost
4040
ENV MODEL_RUNNER_HOST=http://model-runner.docker.internal
4141
ENV LAB_RUNNER_PUBLIC_KEY_PATH=/etc/lab-runner/public-key/runner.pem
4242

43-
# Making this a symlink because the file is being provided via a volume and there isn't a
44-
# way to mount a single file out of a volume (don't want to overwrite the whole .docker dir)
45-
RUN ln -s /docker-creds/config.json /home/coder/.docker/config.json
43+
USER root
44+
COPY ./entrypoint.d /entrypoint.d
45+
46+
USER 1000
4647

4748
CMD ["/home/coder/project"]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [ -f /docker-creds/config.json ]; then
6+
echo "Copying Docker credentials..."
7+
mkdir -p /home/coder/.docker
8+
cp /docker-creds/config.json /home/coder/.docker/config.json
9+
echo "Docker credentials copied successfully."
10+
chown -R coder:coder /home/coder/.docker
11+
else
12+
echo "No Docker credentials found to copy."
13+
fi

0 commit comments

Comments
 (0)