Skip to content

Instantly share code, notes, and snippets.

@toricls
Last active April 26, 2023 23:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toricls/e17c7f2f1c024cc368dcd860804194f5 to your computer and use it in GitHub Desktop.
Save toricls/e17c7f2f1c024cc368dcd860804194f5 to your computer and use it in GitHub Desktop.
Docker-in-Docker with Amazon Linux 2 Container
FROM amazonlinux:2
RUN yum -y update \
# 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.
&& yum -y install systemd \
&& yum clean all
RUN cd /lib/systemd/system/sysinit.target.wants/; \
for i in *; do [ $i = systemd-tmpfiles-setup.service ] || rm -f $i; done
RUN rm -f /lib/systemd/system/multi-user.target.wants/* \
/etc/systemd/system/*.wants/* \
/lib/systemd/system/local-fs.target.wants/* \
/lib/systemd/system/sockets.target.wants/*udev* \
/lib/systemd/system/sockets.target.wants/*initctl* \
/lib/systemd/system/basic.target.wants/* \
/lib/systemd/system/anaconda.target.wants/*
RUN amazon-linux-extras install epel docker && \
systemctl enable docker
CMD ["/usr/sbin/init"]
@toricls
Copy link
Author

toricls commented Apr 26, 2023

@tjtaill According to the error message you got, it looks you need to run Docker daemon beforehand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment