我正在构建一个基于 alpine 的 docker 堆栈。鉴于我的:
php7-dockerfile
:
FROM php:7-fpm-alpine
RUN apk update && \\
apk upgrade && \\
apk add --update autoconf gcc
和docker-compose.yml
:
version: "2"
services:
php:
build:
context: .
dockerfile: php7-dockerfile
container_name: test_php
volumes_from:
- data
跑步docker-compose build
时我得到:
Building data
Step 1 : FROM busybox
---> 47bcc53f74dc
Step 2 : ADD ./web /var/www/html
---> Using cache
---> fc7f0c26a44d
Successfully built fc7f0c26a44d
Building php
Step 1 : FROM php:7-fpm-alpine
---> 86c28f7ac7f5
Step 2 : RUN apk update && \ apk upgrade && \ apk add --update autoconf gcc
---> Running in dc5c837f869c
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
v3.4.1-13-gdf6ff3e [http://dl-cdn.alpinelinux.org/alpine/v3.4/main]
v3.4.0-75-g8d1dc52 [http://dl-cdn.alpinelinux.org/alpine/v3.4/community]
OK: 5966 distinct packages available
/bin/sh: : not found
ERROR: Service 'php' failed to build: The command '/bin/sh -c apk update && \ apk upgrade && \ apk add --update autoconf gcc' returned a non-zero code: 127
我对它为什么使用/bin/sh
以及为什么找不到它感到困惑,因为在我现有的正在运行的容器中我可以运行
$ docker exec -it test_php /bin/sh
/var/www/html #
我究竟做错了什么?