0

I want to build a docker image of a composer from this page composer:latest and taking exactly this Dockerfile

but when I do this in console:

$ wget -O Dockerfile https://raw.githubusercontent.com/composer/docker/edf4f0abf50da5d967408849434b9053a195b65f/1.7/Dockerfile
$ docker build -t mycomposer:latest .

i got this build error:

Step 9/12 : COPY docker-entrypoint.sh /docker-entrypoint.sh COPY failed: stat /var/lib/docker/tmp/docker-builder787686173/docker-entrypoint.sh: no such file or directory

How come I have any error building from official Dockerfile? This way works:

$ docker pull composer:latest

but I need to build an image basing on a local Dockerfile instead of just pulling it.

Jimmix
  • 5,644
  • 6
  • 44
  • 71
  • Do you have the whole https://github.com/composer/docker/ repository, or just the one Dockerfile? Why can't you use the prebuilt image? – David Maze Sep 13 '18 at 21:06
  • no, I just downloaded Dockerfile itself and used it to do build (two lines of console commands). I wanted to use prebuild Dockerfile as a template to make my own version but I'm not even able to build it unmodified. – Jimmix Sep 13 '18 at 21:13

1 Answers1

0

The command

COPY docker-entrypoint.sh /docker-entrypoint.sh

in the Dockerfile tries to copy the file docker-entrypoint.sh from your current directory.
However you have only downloaded the Dockerfile.

If you visit the actual directory on the repository you will notice another file entitled
docker-entrypoint.sh. If you download this file too and place it in the same directory
as the Dockerfile the image will be built without errors.

K. Railis
  • 186
  • 3
  • 8
  • downloading docker-entrypoint.sh to the dir of Dockerfile helped, the build is done but besides the image I wanted I have also created 10 others named none:none with the same size, do you know why they ware created/not removed? – Jimmix Sep 13 '18 at 21:38
  • In the process of building an image, Docker creates these intermediate images to help with caching for repeated builds. `docker image prune` will remove dangling images, such as the : type you mentioned. – K. Railis Sep 13 '18 at 21:55
  • `docker image prune` did not work, all intermediate images left and when i wanted to remove some of them with `docker rmi #image-id` I got err: unable to delete #image-id (cannot be forced) - image has dependent child images – Jimmix Sep 13 '18 at 22:51
  • I believe those images are the remains of previous unsuccessful builds. I think this is what you are looking for: https://stackoverflow.com/a/43463968/6504247 – K. Railis Sep 14 '18 at 13:14