debian based docker in docker and docker cli images

This commit is contained in:
2025-06-03 13:38:53 -05:00
parent 1b18f8c520
commit 7508cd213e
5 changed files with 215 additions and 0 deletions

27
debian-dind.Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
FROM debian:bookworm
# Install necessary packages for setting up the Docker repository
RUN apt update && \
apt install --no-install-recommends -y \
ca-certificates curl gnupg dpkg lsb-release && \
rm -rf /var/lib/apt/lists/*
# Add Dockers official GPG key and repo
RUN install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-ce.gpg && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-ce.gpg] \
https://download.docker.com/linux/debian $(lsb_release -sc) stable" > /etc/apt/sources.list.d/docker.list
# Install full Docker Engine + dependencies required to run dockerd
RUN apt update && \
apt install --no-install-recommends -y \
docker-ce docker-ce-cli containerd.io \
docker-buildx-plugin docker-compose-plugin \
iptables iproute2 xz-utils e2fsprogs util-linux && \
rm -rf /var/lib/apt/lists/*
# Add an entrypoint to start the daemon
COPY dockerd-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["dockerd-entrypoint.sh"]
CMD ["bash"]

21
debian-docker.Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
FROM debian:bookworm
# Install prerequisites for Docker CLI
RUN apt update && \
apt install --no-install-recommends -y \
ca-certificates curl gnupg dpkg lsb-release && \
rm -rf /var/lib/apt/lists/*
# Add Dockers official GPG key and repository
RUN install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-ce.gpg && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-ce.gpg] \
https://download.docker.com/linux/debian $(lsb_release -sc) stable" > /etc/apt/sources.list.d/docker.list
# Install Docker CLI (no daemon)
RUN apt update && \
apt install --no-install-recommends -y \
docker-ce-cli docker-compose-plugin && \
rm -rf /var/lib/apt/lists/*
CMD ["bash"]

View File

@@ -0,0 +1,71 @@
# Base image with Docker-in-Docker capability
FROM deltreey/debian-dind:bookworm
# Metadata
LABEL maintainer="edward.coderman@mythicdevelopment.com"
# Install core build tools and libraries
RUN apt update && apt install -y --no-install-recommends \
bash \
curl \
git \
build-essential \
libssl-dev \
libffi-dev \
libncurses-dev \
libreadline-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
sqlite3 \
libsqlite3-dev \
wget \
ca-certificates \
sudo \
coreutils \
tini && \
apt clean && rm -rf /var/lib/apt/lists/*
# Set pyenv environment
ENV PYENV_ROOT /root/.pyenv
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
# Install pyenv and Python
RUN curl https://pyenv.run | bash && \
bash -c "source ~/.bashrc && pyenv install 3.12 && pyenv global 3.12"
# Upgrade pip + install pyinstaller
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir pyinstaller
# Install uv (https://github.com/astral-sh/uv)
RUN curl -Ls https://astral.sh/uv/install.sh | bash && \
ln -sf /root/.local/bin/uv /usr/local/bin/uv
# Use bash for subsequent shell commands
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Setup NVM environment
ENV NVM_DIR /app/.nvm
ENV BASH_ENV /app/.bash_env
RUN mkdir -p "$NVM_DIR" && touch "$BASH_ENV" && \
echo "export NVM_DIR=$NVM_DIR" >> "$BASH_ENV" && \
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> "$BASH_ENV"
# Install NVM and Node.js
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | PROFILE="$BASH_ENV" bash && \
bash -c "source $BASH_ENV && nvm install 20 && nvm alias default 20 && nvm use default && \
ln -sf $(command -v node) /usr/local/bin/node && \
ln -sf $(command -v npm) /usr/local/bin/npm && \
ln -sf $(command -v npx) /usr/local/bin/npx"
# Add pyenv config to shell profile
RUN echo 'export PYENV_ROOT="/root/.pyenv"' >> "$BASH_ENV" && \
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> "$BASH_ENV" && \
echo 'eval "$(pyenv init --path)"' >> "$BASH_ENV" && \
echo 'eval "$(pyenv init -)"' >> "$BASH_ENV"
# Final entrypoint
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["bash", "-l"]

View File

@@ -0,0 +1,71 @@
# Base image with Docker-in-Docker capability
FROM deltreey/debian-docker:bookworm
# Metadata
LABEL maintainer="edward.coderman@mythicdevelopment.com"
# Install core build tools and libraries
RUN apt update && apt install -y --no-install-recommends \
bash \
curl \
git \
build-essential \
libssl-dev \
libffi-dev \
libncurses-dev \
libreadline-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
sqlite3 \
libsqlite3-dev \
wget \
ca-certificates \
sudo \
coreutils \
tini && \
apt clean && rm -rf /var/lib/apt/lists/*
# Install pyenv
ENV PYENV_ROOT /root/.pyenv
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH
RUN curl https://pyenv.run | bash && \
bash -c "source ~/.bashrc && pyenv install 3.12 && pyenv global 3.12"
# Upgrade pip + install pyinstaller
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir pyinstaller
# Install uv (https://github.com/astral-sh/uv)
RUN curl -Ls https://astral.sh/uv/install.sh | bash && \
ln -sf /root/.local/bin/uv /usr/local/bin/uv
# Use bash for the shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Environment for bash + NVM
ENV NVM_DIR /app/.nvm
ENV BASH_ENV /app/.bash_env
# Setup shell sourcing
RUN mkdir -p "$NVM_DIR" && touch "$BASH_ENV" && \
echo "export NVM_DIR=$NVM_DIR" >> "$BASH_ENV" && \
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> "$BASH_ENV"
# Install NVM and Node.js
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | PROFILE="$BASH_ENV" bash && \
bash -c "source $BASH_ENV && nvm install 20 && nvm alias default 20 && nvm use default && \
ln -sf $(command -v node) /usr/local/bin/node && \
ln -sf $(command -v npm) /usr/local/bin/npm && \
ln -sf $(command -v npx) /usr/local/bin/npx"
# Add pyenv config to bash
RUN echo 'export PYENV_ROOT="/root/.pyenv"' >> "$BASH_ENV" && \
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> "$BASH_ENV" && \
echo 'eval "$(pyenv init --path)"' >> "$BASH_ENV" && \
echo 'eval "$(pyenv init -)"' >> "$BASH_ENV"
# Set final entrypoint
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["bash", "-l"]

25
dockerd-entrypoint.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
set -e
# Create required directories if they don't exist
mkdir -p /var/run/docker
# Start the Docker daemon in the background
dockerd &
# Wait until Docker is ready
timeout=60
until docker info >/dev/null 2>&1; do
if [ $timeout -le 0 ]; then
echo >&2 "❌ Docker daemon failed to start within expected time."
exit 1
fi
echo "⏳ Waiting for Docker to be ready... ($timeout)"
sleep 1
timeout=$((timeout - 1))
done
echo "✅ Docker daemon is up and running."
# Execute any passed command (default: bash)
exec "$@"