当构建docker apache镜像时,构建在此步骤中失败:
Step n/m : COPY httpd-foreground /usr/local/bin/
ERROR: Service 'apache' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder511740141/httpd-foreground: no such file or directory
这是我的docker_compose.yml文件
version: '3'
services:
mysql:
image: mysql:5.7
container_name: mysql_octopus_dev
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: app
MYSQL_USER: root
MYSQL_PASSWORD: root
apache:
build: .
container_name: apache_octopus_dev
volumes:
- .:/var/www/html/
ports:
- "8000:80"
depends_on:
- mysql
这是我的 docker 文件
FROM debian:jessie-backports
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
#RUN groupadd -r www-data && useradd -r --create-home -g www-data www-data
...
COPY httpd-foreground /usr/local/bin/
EXPOSE 80
CMD ["httpd-foreground"]
有什么帮助吗?
最佳答案
Dockerfile中的路径始终相对于上下文目录。上下文目录是传递给docker build的位置参数(通常为)。
我应该将httpd-foreground文件放置在dockerfile的同一文件夹中。
来自:https://github.com/docker/for-linux/issues/90
关于apache - Docker:镜像构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48451610/