I´m trying to build an image based on linuxamazon that runs the docker daemon. The idea is to automatically run this image on amazon ec2 and execute a workflow using the boto3 api.
Here is the Dockerfile:
FROM amazonlinux:2
RUN yum update -y
RUN yum install -y amazon-linux-extras
RUN yum install -y unzip
RUN yum install vim-enhanced sudo -y
## install aws-cli2
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -rf awscliv2.zip
RUN amazon-linux-extras install docker
RUN service docker start
And here is the output
=> ERROR [9/9] RUN service docker start 1.0s
------
> [9/9] RUN service docker start:
#12 0.718 Redirecting to /bin/systemctl start docker.service
#12 0.719 Failed to get D-Bus connection: Operation not permitted
------
executor failed running [/bin/sh -c service docker start]: exit code: 1
make: *** [Makefile:12: build] Error 1
Any idea or recommendation to run docker inside the linuxamazon image ?