我正在尝试构建一个使用GDAL和必要的Python挂钩运行Alpine Linux的Docker容器:
FROM python:3.6-alpine
RUN apk update
RUN apk add py-gdal gdal
RUN pip install uwsgi
RUN mkdir /code
WORKDIR /code
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["uwsgi", "--ini", "uwsgi.ini"]
如您所见,我正在运行apk update
语句来更新存储库,然后运行apk add
语句来安装软件包。这是我收到的输出:
/usr/bin/make -f /Users/some_guy/Workspace/tagging_tracker_backend/Makefile build up
Pulling nginx ...
Pulling db ...
Pulling web ...
db uses an image, skipping
Building nginx
Step 1/3 : FROM nginx:1.15
---> 7042885a156a
Step 2/3 : RUN rm /etc/nginx/conf.d/default.conf
---> Using cache
---> 97782a5dae3a
Step 3/3 : COPY nginx.conf /etc/nginx/conf.d/tag.conf
---> Using cache
---> 3158ab7993cd
Successfully built 3158ab7993cd
Building web
Successfully tagged tagging_tracker_backend_nginx:latest
Step 1/10 : FROM python:3.6-alpine
---> de35df1f34dd
Step 2/10 : RUN apk update
---> Using cache
---> 15477d802b32
Step 3/10 : RUN apk add py-gdal gdal
---> Running in 77bef31e5d15
ERROR: unsatisfiable constraints:
gdal (missing):
required by: world[gdal]
py-gdal (missing):
required by: world[py-gdal]
Service 'web' failed to build: The command '/bin/sh -c apk add py-gdal gdal' returned a non-zero code: 2
make: *** [build] Error 1
Process finished with exit code 2
这两个软件包均可在the Alpine Linux package website上找到。
我不熟悉Alpine Linux,但是习惯于在其他类型的Linux上安装软件包。这里是否需要传递另一个命令?
答案 0 :(得分:7)
您链接到的gdal
包位于边缘测试存储库中,而不是发行分支之一。要安装它,您必须专门指定该存储库。 gdal
也依赖edge-main中的软件包,因此您也需要包括它。
apk add \
--no-cache \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
gdal