Skip to content

Instantly share code, notes, and snippets.

@pich4ya
Created February 16, 2019 22:53
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pich4ya/4942fd2c854044500c90c8297a5ca994 to your computer and use it in GitHub Desktop.
Save pich4ya/4942fd2c854044500c90c8297a5ca994 to your computer and use it in GitHub Desktop.
How to fix "ERROR: No build stage in current context"
Problem:
$ docker-compose up --build
Building xxx
ERROR: No build stage in current context
Analysis:
Dockerfile
# you do something BEFORE the 'FROM' statement
COPY --chown=root:root /php /var/www/html/
FROM php:5.6.39-apache
Solution:
# do something AFTER the 'FROM' statement
FROM php:5.6.39-apache
COPY --chown=root:root /php /var/www/html/
@d0zingcat
Copy link

just to add one notice, the maintainer tag should not be placed above FROM clause, as the first statement must be FROM clause.

@macagua
Copy link

macagua commented Apr 20, 2022

👍 bravo thank you!

@elgatov
Copy link

elgatov commented Dec 14, 2022

@d0zingcat THANK YOU. This was making my build fail with no clear explanation.

@hazelrah2
Copy link

Also helpful for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment