vscode-dev-containers icon indicating copy to clipboard operation
vscode-dev-containers copied to clipboard

Add Docker-from-Docker on Alpine

Open ferm10n opened this issue 4 years ago • 3 comments

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

ferm10n avatar Jan 16 '21 00:01 ferm10n

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.

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

ghost avatar Jan 16 '21 00:01 ghost

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.

2percentsilk avatar Jan 20 '21 23:01 2percentsilk

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: https://github.com/microsoft/vscode-dev-containers/issues/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 https://github.com/microsoft/vscode-dev-containers/issues/1589) when our new templates repo is available and the process is defined.

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

bamurtaugh avatar Sep 02 '22 21:09 bamurtaugh