Skip to content

Instantly share code, notes, and snippets.

@toricls
Last active April 21, 2022 15:16
Embed
What would you like to do?
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 Jul 16, 2021

docker build -t ecs-anywhere-node .

docker run -d --privileged \
  --name ecs-anywhere \
  -p 8080-8090:8080-8090 ecs-anywhere-node:latest

docker exec -it ecs-anywhere /bin/bash

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