Dockerfile build - possible to ignore error?

dockerfile exit on error
docker build
dockerfile fail on error
docker ignore
docker build catch error
dockerfile volume
docker build volume
bash ignore error

I've got a Dockerfile. When building the image, the build fails on this error:

automake: error: no 'Makefile.am' found for any configure output
Error build: The command [/bin/sh -c aclocal && autoconf && automake -a] returned a non-zero code: 1

which in reality is harmless. The library builds fine, but Docker stops the build once it receives this error. Is there any way I can instruct Docker to just ignore this?

Sure. Docker is just responding to the error codes returned by the RUN shell scripts in the Dockerfile. If your Dockerfile has something like:

RUN make

You could replace that with:

RUN make; exit 0

This will always return a 0 (success) exit code. The disadvantage here is that your image will appear to build successfully even if there are actual errors in the build process.

Skip error in dockerfile during the build, essentially uses different syntax to achieve the same. Dockerfile build - possible to ignore error? there is no other way of preventing build failure at present. I uninstalled previous versions of Docker and docker-compose, I reinstalled the new docker for macosx. The dir structure ha both the docker-compose.yml and Dockerfile in the same directory, here are the files: #Dockerfile. FROM node:latest MAINTAINER Daniel Ram COPY . /var/www WORKDIR /var/www RUN npm install EXPOSE 3000 CMD ["npm", "start"]

This might be of interest to those, whose potential errors in their images are not harmless enough to go unnoticed/logged. (Also, not enough rep. to comment, so here as an answer.)

As pointed out, the disadvantage of RUN make; exit 0 is you don't get to know, if your build failed. Hence, rather use something like:

make test 2>&1 > /where/ever/make.log || echo "There were failing tests!"

Like this, you get notified via the docker image build process log, and you can see what exactly went bad during make (or whatsoever else execution, this is not restricted to make).

Dockerfile build, I've got a Dockerfile. When building the image, the build fails on this error: automake: error: no 'Makefile.am' found for any configure output  ignore.1 < Dockerfile.2 file.2 directory.2 ignore.2 < Dockerfile.1 file.1 directory.1 and then do. docker build -f Dockerfile.1 --ignore ignore.1 . docker build -f Dockerfile.2 --ignore ignore.2 . This is a terrible way to do things, the ignore file for the first build is listing the files for the second build because it is subtractive not

You can also use the standard bash ignore error || true, which is nice if you are in the middle of a chain:

RUN <first stage> && <job that might fail> || true && <next stage>

Way to ignore errors for COPY/ADD of optional files · Issue #26332 , Due the lack of any way to ignore possible known errors on COPY fe. the for npm-shinkwrap.json file (only package.json) as the builds that don't have locally and using official node.js Docker images and yet you could be  One of the projects I'm working on has a CI/CD pipeline that builds Docker images. The Dockerfile runs yarn install, then yarn build. The latter runs the TypeScript compiler tsc. Everything was working fine, but one day the build failed with the following error:

ImageBuild is ignoring build errors · Issue #14 · docker/go-docker , If my Dockerfile has a COPY command where the file is missing, ImageBuild does not report the error. Here is my Dockerfile: FROM  For example, if a Dockerfile attempts to ADD a nonexistent file to an image, docker build will report an error message and refuse to complete the image, but will also exit with a status code of 0. I do see that BuildFile.addContext is attempting to report the error condition properly here, so I'm not sure why the binary is exiting with success.

docker build, To increase the build's performance, you can exclude files and directories by adding a Note: docker build will return a no such file or directory error if the file or from the registry and determine possible cache hits based on that information. Best practices for writing Dockerfiles Estimated reading time: 31 minutes This document covers recommended best practices and methods for building efficient images. Docker builds images automatically by reading the instructions from a Dockerfile-- a text file that contains all commands, in order, needed to build a given image.

Dockerfile reference, To increase the build's performance, exclude files and directories by adding a .​dockerignore Sending build context to Docker daemon 2.048 kB Error response from Whenever possible, Docker will re-use the intermediate images (cache),  When you run docker build, each command in the Dockerfile (e.g. FROM, ENV, RUN) is a step in the build process. Docker processes each step in an intermediate container. Docker processes each step

Comments
  • I've came here when trying to run service php7-fpm start. It would return 1 and RUN would fail; using service php7-fpm start; service php7-fpm status does the trick - it seems to solve a problem during build as well, since both commands running separate would give trouble.
  • I've come here when trying to build Qt5 from source. It would build just fine, but using concurrent build combined with the fact that Qt build process has build-time tests run from make (that intentionally fail) my RUN command exited with error (2). This hopefully will solve the problem!
  • This is waaay underrated answer. My use case was some package lists not reachable and apt-get update -y was failing.
  • just what i needed :) what would be even more better is to fail if job failed, but after next stage (cleanup)