11# Note: You can use any Debian/Ubuntu based image you want.
22FROM mcr.microsoft.com/vscode/devcontainers/base:bullseye
33
4+ # root acess for beginning of the script
5+ USER root
6+
47# [Option] Install zsh
58ARG INSTALL_ZSH="true"
69# [Option] Upgrade OS packages to their latest versions
@@ -23,9 +26,18 @@ RUN apt-get update \
2326 && /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \
2427 # Use Docker script from script library to set things up
2528 && /bin/bash /tmp/library-scripts/docker-debian.sh "${ENABLE_NONROOT_DOCKER}" "/var/run/docker-host.sock" "/var/run/docker.sock" "${USERNAME}" \
29+ # Create the baseuser user and group
30+ && groupadd -r baseuser && useradd -r -g baseuser baseuser \
2631 # Clean up
2732 && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/
2833
34+ # Create directories for Elasticsearch and add necessary permissions
35+ RUN mkdir -p /usr/share/elasticsearch /var/lib/elasticsearch /var/log/elasticsearch \
36+ && chown -R baseuser:baseuser /usr/share/elasticsearch /var/lib/elasticsearch /var/log/elasticsearch
37+
38+ # Switch back to the baseuser
39+ USER baseuser
40+
2941# Setup the app here
3042
3143# Setting the ENTRYPOINT to docker-init.sh will configure non-root access
@@ -35,4 +47,4 @@ CMD [ "sleep", "infinity" ]
3547
3648# [Optional] Uncomment this section to install additional OS packages.
3749# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
38- # && apt-get -y install --no-install-recommends <your-package-list-here>
50+ # && apt-get -y install --no-install-recommends <your-package-list-here>
0 commit comments