You can install aws-cli on alpine docker image by creating a Dockerfile as shown below. Or use a docker image pre-installed with aws-cli like bitnami/aws-cli:latest.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
## Create a docker file FROM alpine:latest RUN apk add --no-cache \ python3 \ py3-pip \ && pip3 install --upgrade pip \ && pip3 install \ awscli \ && rm -rf /var/cache/apk/* RUN aws --version # Should output aws-cli/1.18.69 etc. ## Build an image from Dockerfile docker image build -t myimage . ## Validate the output for successfull installation ## Step 3/3 : RUN aws --version ## ---> Running in 0a02a3cb8d23 ## aws-cli/1.20.58 Python/3.9.5 Linux/4.14.243-185.433.amzn2.x86_64 botocore/1.21.58 ## list images docker image ls -a ## Create a container from the image docker container create --name mycontainer myimage ## Or use an image that has aws-cli already installed in it docker run --name aws-cli bitnami/aws-cli:latest |