I have already created an image locally and it contains two layers
$ docker images inspect existingimagename
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:e21695bdc8e8432b1a119d610d5f8497e2509a7d040ad778b684bbccd067099f",
"sha256:3ff73e68714cf1e9ba79b30389f4085b6e31b7a497f986c7d758be51595364de"
]
},
Now i am building another image and want to save space. The first layer of the previous image is the main file system. So i decided to use it
FROM sha256:e21695bdc8e8432b1a119d610d5f8497e2509a7d040ad778b684bbccd067099f
ENV LANG=en_US.UTF-8
CMD ["/usr/bin/bash"]
Then i try to build the new image
$ docker build -t newimage -f Dockerfile .
Sending build context to Docker daemon 443.5MB
Step 1/3 : FROM sha256:e21695bdc8e8432b1a119d610d5f8497e2509a7d040ad778b684bbccd067099f
pull access denied for sha256, repository does not exist or may require 'docker login'
it gives error.
So how to deal with this.
ADDcommand has different purpose, see docs.docker.com/engine/reference/builder/#add for more details. For referencing layers you have to useFROMinstruction. Can you addDockerfileofexistingimagenameand describe what exactly do you want to reuse?