Installing Docker in custom docker image

Published

This is what I’m trying to do. I have a CICD pipeline I am using to push a docker image into ECR. Within this pipeline I am using a custom Docker image that has the AWSCLIv2, kubectl, and I am trying to also integrate docker within this custom image. I learned this is possible but I am having some blockers. Originally my solution supported the AWSCLI version 1, but I need to have AWSCLIv2. I learned to have v2 of the AWSCLI is a little complex, so that is why I am using Amazon’s official image located here. Below is my dockerfile. When I try to build my image, I’m getting an error stating there is no docker package available, which is confusing to me because I had installed docker utilizing yum before. Any advice would be appreciated.

Dockerfile

FROM amazon/aws-cli

ARG KUBECTL_VERSION=1.17.5

RUN yum update -y 
  && yum install docker -y 
  && service docker start

RUN yum install curl -y 
  && curl -sLO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl 
  && mv kubectl /usr/bin/kubectl 
  && chmod +x /usr/bin/kubectl

WORKDIR /apps

Error

Step 3/5 : RUN yum update -y   && yum install docker -y   && service docker start
---> Running in e2473ec54a07
Loaded plugins: ovl, priorities
No packages marked for update
Loaded plugins: ovl, priorities
No package docker available.
Error: Nothing to do
The command '/bin/sh -c yum update -y   && yum install docker -y   && service docker start' returned a non-zero code: 1

Source: Docker Questions

Answers

Leave a Reply

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq