Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Add Docker-from-Docker on Alpine #721

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

ferm10n
Copy link

@ferm10n ferm10n commented Jan 16, 2021

I modeled this off the docker-debian.sh script, to allow using docker-from-docker on an alpine distro, like https://github.com/microsoft/vscode-dev-containers/tree/master/containers/docker-from-docker

That link was for debian/ubuntu only, but this would allow alpine to be used as well.

And here's the Dockerfile I tested it with:

FROM alpine

# [Option] Install zsh
ARG INSTALL_ZSH="true"
# [Option] Enable non-root Docker access in container
ARG ENABLE_NONROOT_DOCKER="true"

# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
ARG USERNAME=automatic
ARG USER_UID=1000
ARG USER_GID=$USER_UID
COPY .devcontainer/*.sh /tmp/library-scripts/
RUN apk update && ash /tmp/library-scripts/common.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" \
    # Use Docker script from script library to set things up
    && /bin/bash /tmp/library-scripts/docker.sh "${ENABLE_NONROOT_DOCKER}" "/var/run/docker-host.sock" "/var/run/docker.sock" "${USERNAME}" \
    # Clean up
    && rm -rf /tmp/library-scripts /var/cache/apk/*

# 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" ]

I don't believe alpine has a moby-cli package
might need to verify these were ok:
- remove apt-transport-https
- remove lsb-release
- change gnupg2 to gnupg
@ghost
Copy link

ghost commented Jan 16, 2021

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

❌ ferm10n sign now
You have signed the CLA already but the status is still pending? Let us recheck it.

@2percentsilk
Copy link
Member

Hi @ferm10n,
A few things to chat about before we can merge this.

  1. Given this a new definition you're providing, are you willing to take on the responsibility of maintaining it?
  2. If you are comfortable maintaining this definition moving forward, we'll need you to do the following:
  • Agree to the CLA
  • Update the test script to ensure this scenario is covered.

Once that's complete, I can merge this and update our docker.md file to indicate that Alpine is community supported.

@Chuxel Chuxel added the info-needed Issue requires more information from poster label Jun 29, 2021
@bamurtaugh
Copy link
Member

Thanks again for opening this!

As a heads up, our team has been actively focused on an updated plan for community contributions and this repo moving forward, which we've now outlined in this issue: #1589. This includes moving to a couple new repos for images (https://github.com/devcontainers/images) and Features (https://github.com/devcontainers/features).

We anticipate to have a similar repo and distribution process for templates/definitions. We'll keep everyone updated (likely via another issue in this repo or comment on #1589) when our new templates repo is available and the process is defined.

Please let me know if you have any questions, thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants