【问题标题】:Docker : image build failedDocker:镜像构建失败
【发布时间】:2018-01-25 20:46:01
【问题描述】:

在构建docker apache镜像时,这一步构建失败:

Step n/m : COPY httpd-foreground /usr/local/bin/

错误:服务“apache”构建失败:复制失败:stat /var/lib/docker/tmp/docker-builder511740141/httpd-foreground:没有这样的 文件或目录

这是我的 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"]

有什么帮助吗?

【问题讨论】:

  • 在您的构建上下文(docker build 命令末尾的目录)中是否有一个名为 httpd-foreground 的文件。您是否使用.dockerignore 将其排除在外?
  • 不,我没有 .dockerignore 文件,我将文件放在错误的路径中。

标签: apache docker docker-compose


【解决方案1】:

Dockerfile 中的路径总是相对于上下文目录。上下文目录是传递给 docker build 的位置参数(通常是 .)。

我应该把 httpd-foreground 文件放在 dockerfile 的同一个文件夹中。

发件人:https://github.com/docker/for-linux/issues/90

【讨论】:

    猜你喜欢
    • 2022-01-02
    • 1970-01-01
    • 1970-01-01
    • 2019-08-13
    • 2021-11-03
    • 1970-01-01
    • 1970-01-01
    • 2022-11-29
    • 1970-01-01
    相关资源
    最近更新 更多