<p>I in the process of dockerizing an angular 9 application. My plan is to build the Docker from &quot;scratch&quot; then add the Ubuntu Bionic followed by Nginx followed by Angular and finally the theme assets and application UI code.</p>
<p>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</p>
<pre><code>export DOCKER_HOST=ssh://sridhar@999.99.999.999:9999
</code></pre>
<p>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.</p>
<p>I have the following docker file</p>
<pre><code># 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 /
</code></pre>
<p>When I try to build the image I get the following error</p>
<pre><code>$ docker build --tag abui .
Sending build context to Docker daemon  104.2MB
Step 1/2 : FROM scratch
 ---&gt; 
Step 2/2 : ADD docker pull ubuntu:focal-20201008 /
ADD failed: stat /var/lib/docker/tmp/docker-builder302666646/docker: no such file or directory
</code></pre>
<p>I am unable to understand why the Ubuntu Image cannot be added.</p>

CC BY-SA 4.0
2020-11-02T11:29:48.180Z
what will happen if you use `RUN` instead of `ADD`.  `ADD` is similar to `COPY`, as far as I know, according to the error message it is trying to add the `docker` file, (which is not there) from the current location to somewhere.
Prakash
CC BY-SA 4.0
2020-11-02T12:58:23.357Z
`ADD` tries to add files to your image, while `docker 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 with `FROM ubuntu:focal-20201008`?
Lykanion
CC BY-SA 4.0
2020-11-02T14:24:19.867Z
@Lykanion please post your comments as answer. Will accept it. Took me sometime to realize it. I have started FROM the Ubuntu image because I feel  that as application developers it's better to start from the OS and the OS image anyway would be FROM scratch.
sridhar pandurangiah
CC BY-SA 4.0
2020-11-03T08:46:14.660Z
glad to help :)
Lykanion
<docker><ubuntu>
Docker failing while adding Ubuntu Image
sridhar pandurangiah
# Docker failing while adding Ubuntu Image

(Asked by: username_0 on 2020-11-02)

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://sridhar@999.99.999.999: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.

**Tags:** docker, ubuntu

> **Comments:**
> **username_1**: what will happen if you use `RUN` instead of `ADD`.  `ADD` is similar to `COPY`, as far as I know, according to the error message it is trying to add the `docker` file, (which is not there) from the current location to somewhere.  
> **username_2**: `ADD` tries to add files to your image, while `docker 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 with `FROM ubuntu:focal-20201008`?  
> **username_0**: @username_2 please post your comments as answer. Will accept it. Took me sometime to realize it. I have started FROM the Ubuntu image because I feel  that as application developers it's better to start from the OS and the OS image anyway would be FROM scratch.  
> **username_2**: glad to help :)  

---

## 0 answers

