我正在寻找在fpm-alpine容器上设置laravel.遇到以下Dockerfile产生一些错误的障碍......
FROM php:7-fpm-alpine
# install extensions needed for Laravel
RUN apk --update add \
php7-mysqli \
php7-mcrypt \
php7-mbstring \
rm /var/cache/apk/*
Run Code Online (Sandbox Code Playgroud)
产生的错误是:
Building fpm
Step 1 : FROM php:7-fpm-alpine
---> 9e6811cb8bac
Step 2 : RUN apk --update add php7-mysqli php7-mcrypt php7-mbstring rm /var/cache/apk/*
---> Running in 87364957eb57
fetch http://dl-cdn.alpinelinux.org/alpine/v3.3/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.3/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
/var/cache/apk/* (missing):
required by: world[/var/cache/apk/*]
php7-mbstring (missing):
required by: world[php7-mbstring]
php7-mcrypt (missing):
required by: world[php7-mcrypt]
php7-mysqli (missing):
required by: world[php7-mysqli]
rm (missing):
required by: world[rm] …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Alpine图像来处理一些Postgres数据库创建/准备工作。在容器内,我正在运行以下命令:
createdb -e -O ${DB_USER} ${DB_NAME}
psql -e -d ${DB_NAME} -c "CREATE EXTENSION postgis;"
Run Code Online (Sandbox Code Playgroud)
第一行工作正常,但第二行不行。
我已经用两个 docker 构建尝试过这个:
FROM alpine:3.6
RUN apk add -U postgresql
COPY ./db-creator.sh /db-creator.sh
CMD ["./db-creator.sh"]
Run Code Online (Sandbox Code Playgroud)
这张图片给了我以下错误:
CREATE EXTENSION postgis;
ERROR: could not open extension control file "/usr/share/postgresql/10/extension/postgis.control": No such file or directory
Run Code Online (Sandbox Code Playgroud)
我没有尝试PostGIS直接安装,因为本论坛中有人坚持认为apk add -U postgresql裸Alpine图像就足够了。
FROM postgres:9.6.4-alpine
RUN apk add -U postgresql
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN …Run Code Online (Sandbox Code Playgroud) 好的,所以任务看起来很简单!使用Alpine图像(因为它轻量级且安全)来执行一些PostgreSQL数据库创建/迁移。我使用的是以下Dockerfile使用的代码在这里:
FROM alpine:latest
RUN apk add -U postgresql
# install PostGIS
ENV POSTGIS_VERSION 2.5.2
ENV POSTGIS_SHA256 225aeaece00a1a6a9af15526af81bef2af27f4c198de820af1367a792ee1d1a9
RUN set -ex \
\
&& apk add --no-cache --virtual .fetch-deps \
ca-certificates \
openssl \
tar \
\
&& wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/$POSTGIS_VERSION.tar.gz" \
&& echo "$POSTGIS_SHA256 *postgis.tar.gz" | sha256sum -c - \
&& mkdir -p /usr/src/postgis \
&& tar \
--extract \
--file postgis.tar.gz \
--directory /usr/src/postgis \
--strip-components 1 \
&& rm …Run Code Online (Sandbox Code Playgroud)