aws-cli - 如何在高山上安装 aws-cli?
问题描述
我正在运行 alpine 的 docker swarm 管理器节点上安装 aws-cli(Linux 0317632a4ad9 4.9.59-moby #1 SMP Thu Mar 1 20:54:00 UTC 2018 x86_64 Linux)。Alpine 的 aws-cli 包目前列在边缘分支 (1.18.55.r0) 的社区 repo 中。我修改/etc/apk/repositories
为针对这个 repo。
安装爆炸寻找 py3-urllib3,但我解决了这个问题,最后得到了一个干净的安装,没有错误,如下所示:
~ $ sudo apk add aws-cli@edge-comm
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
py3-urllib3-1.25.9-r0:
masked in: @edge
satisfies: py3-botocore-1.16.12-r0[py3-urllib3<1.26]
~ $ sudo apk add py3-urllib3@edge aws-cli@edge-comm
(1/23) Installing groff (1.22.3-r1)
(2/23) Installing py3-six (1.10.0-r6)
(3/23) Installing py3-dateutil (2.6.0-r1)
(4/23) Installing libpng (1.6.37-r0)
(5/23) Installing freetype (2.7.1-r2)
(6/23) Installing libjpeg-turbo (1.5.3-r2)
(7/23) Installing lcms2 (2.8-r1)
(8/23) Installing openjpeg (2.3.0-r2)
(9/23) Installing tiff (4.0.10-r0)
(10/23) Installing libwebp (0.6.0-r0)
(11/23) Installing py3-pillow (4.1.0-r0)
(12/23) Installing py3-roman (2.0.0-r2)
(13/23) Installing py3-docutils (0.13.1-r0)
(14/23) Installing py3-jmespath@edge-comm (0.9.5-r0)
(15/23) Installing py3-urllib3@edge (1.25.9-r0)
(16/23) Installing py3-botocore@edge-comm (1.16.12-r0)
(17/23) Installing py3-s3transfer@edge-comm (0.3.3-r0)
(18/23) Installing py3-colorama@edge-comm (0.4.3-r0)
(19/23) Installing yaml (0.1.7-r0)
(20/23) Installing py3-yaml (3.12-r1)
(21/23) Installing py3-asn1 (0.2.3-r0)
(22/23) Installing py3-rsa (3.4.2-r1)
(23/23) Installing aws-cli@edge-comm (1.18.55-r0)
Executing busybox-1.26.2-r11.trigger
OK: 576 MiB in 81 packages
二进制文件是在 /usr/bin/aws 中创建的,但在寻找 awscli 模块时会崩溃:
~ $ aws
Traceback (most recent call last):
File "/usr/bin/aws", line 19, in <module>
import awscli.clidriver
ModuleNotFoundError: No module named 'awscli'
谢谢!
解决方案
对于任何在谷歌上搜索的人,我一直在使用该图像node:12.16.1-alpine
。
RUN apk add --no-cache \
python3 \
py3-pip \
&& pip3 install --upgrade pip \
&& pip3 install --no-cache-dir \
awscli \
&& rm -rf /var/cache/apk/*
RUN aws --version # Just to make sure its installed alright
# Should output aws-cli/1.18.69 etc.
对我来说工作得很好。
注意:apk --no-cache
并且pip3 --no-cache-dir
用于通过不保留包缓存来保持 Docker 映像精简。
推荐阅读
- javascript - vue-cli 在 TypeScript 项目中加载 .js 模块
- css - 从 Fontawesome 加载图标会导致 express/node.js 下的 404
- python - 从python中的字符串中提取数字
- javascript - Nodejs - 如何从“模块”导出 *
- linux - 使用脚本操作 linux 工作区
- bash - alphine图像中的奇数算术语法错误 - bash
- r - 无法在 linux Redhat 上安装 lidR 包
- python - 在 multiprocessing.Manager().dict() 上获取 ConnectionRefusedError [Errno 61]
- python - Selenium 使用现有配置文件 python 打开 Chrome
- json - 使用 curl 收集数据时出现错误/非法格式的 URL 错误