Skip to content

Instantly share code, notes, and snippets.

@toricls
Created July 19, 2021 04:46
Show Gist options
  • Save toricls/881bb57bcc20fad009fbacf6d493aa9f to your computer and use it in GitHub Desktop.
Save toricls/881bb57bcc20fad009fbacf6d493aa9f to your computer and use it in GitHub Desktop.
Docker-in-Docker with Ubuntu Container
FROM ubuntu:20.04
RUN set -ex \
&& apt update \
&& apt install --no-install-recommends -y \
ca-certificates curl docker.io \
# systemd is not a hard requirement for Amazon ECS Anywhere, but the installation script currently only supports systemd to run.
# Amazon ECS Anywhere can be used without systemd, if you set up your nodes and register them into your ECS cluster **without** the installation script.
systemd init \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /usr/share/doc/* /usr/share/man/* /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN find /etc/systemd/system \
/lib/systemd/system \
-path '*.wants/*' \
-not -name '*dbus*' \
-not -name '*journald*' \
-not -name '*systemd-tmpfiles*' \
-not -name '*systemd-user-sessions*' \
-exec rm \{} \; \
&& systemctl enable docker \
&& systemctl set-default multi-user.target
CMD ["/usr/sbin/init"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment