I in the process of dockerizing an angular 9 application. My plan is to build the Docker from "scratch" then add the Ubuntu Bionic followed by Nginx followed by Angular and finally the theme assets and application UI code.
I have docker on a VPS (I know its strange but then didn't have a baremetal on the cloud to install it) while the docker CLI is on my laptop. I have set the DOCKER_HOST varable as follows
export DOCKER_HOST=ssh://[email protected]:9999
This allows me to connect to the Docker engine on the VPS using my laptop (running Ubuntu). I am able to list the images, deploy containers et all.
I have the following docker file
# Specifying the base image. We would like to create from scratch and then add the layers
FROM scratch
# We will now add the layers as follows Ubuntu 18.04, Nginx,
ADD docker pull ubuntu:focal-20201008 /
When I try to build the image I get the following error
$ docker build --tag abui .
Sending build context to Docker daemon 104.2MB
Step 1/2 : FROM scratch
--->
Step 2/2 : ADD docker pull ubuntu:focal-20201008 /
ADD failed: stat /var/lib/docker/tmp/docker-builder302666646/docker: no such file or directory
I am unable to understand why the Ubuntu Image cannot be added.
RUN
instead ofADD
.ADD
is similar toCOPY
, as far as I know, according to the error message it is trying to add thedocker
file, (which is not there) from the current location to somewhere.ADD
tries to add files to your image, whiledocker pull
is a shell command that will import a new image to docker. This is mixing several concepts, and I'd be surprised if it'd work this way. But first, why don't you simply start from the ubuntu image withFROM ubuntu:focal-20201008
?