From 6ff221e4849b1d82d693196484e74c0ef8b5d645 Mon Sep 17 00:00:00 2001 From: Venkata Mutyala Date: Sat, 22 Oct 2022 19:06:27 +0000 Subject: [PATCH] testing dockerfile updates --- .devcontainer/Dockerfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index fb4b51a..97387cc 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -20,3 +20,22 @@ RUN curl https://stedolan.github.io/jq/download/linux64/jq > /usr/local/bin/jq & RUN apt update && apt install tmux -y && apt clean -y RUN curl -sSL -o /usr/local/bin/argocd https://github.com/argoproj/argo-cd/releases/download/v2.4.11/argocd-linux-amd64 RUN chmod +x /usr/local/bin/argocd + +ARG NONROOT_USER=vscode + +RUN echo "#!/bin/sh\n\ + sudoIf() { if [ \"\$(id -u)\" -ne 0 ]; then sudo \"\$@\"; else \"\$@\"; fi }\n\ + SOCKET_GID=\$(stat -c '%g' /var/run/docker.sock) \n\ + if [ \"${SOCKET_GID}\" != '0' ]; then\n\ + if [ \"\$(cat /etc/group | grep :\${SOCKET_GID}:)\" = '' ]; then sudoIf groupadd --gid \${SOCKET_GID} docker-host; fi \n\ + if [ \"\$(id ${NONROOT_USER} | grep -E \"groups=.*(=|,)\${SOCKET_GID}\(\")\" = '' ]; then sudoIf usermod -aG \${SOCKET_GID} ${NONROOT_USER}; fi\n\ + fi\n\ + exec \"\$@\"" > /usr/local/share/docker-init.sh \ + && chmod +x /usr/local/share/docker-init.sh + +# VS Code overrides ENTRYPOINT and CMD when executing `docker run` by default. +# Setting the ENTRYPOINT to docker-init.sh will configure non-root access to +# the Docker socket if "overrideCommand": false is set in devcontainer.json. +# The script will also execute CMD if you need to alter startup behaviors. +ENTRYPOINT [ "/usr/local/share/docker-init.sh" ] +CMD [ "sleep", "infinity" ] \ No newline at end of file