0

I followed a really simple get-started intro video to docker, and the "hello world" example to start with looks like this:

FROM ubuntu
RUN apt-get update
CMD ["echo","hui there"]

I then build with:

 sudo docker build .

everything goes as planned. Now I run sudo docker images:

ask@Garsy:~/Notes/TA/AppliedInfoSec/docker$ sudo docker images
REPOSITORY   TAG       IMAGE ID       CREATED          SIZE
<none>       <none>    890bf2a53fe0   10 seconds ago   104MB
ubuntu       latest    fb52e22af1b0   4 weeks ago      72.8MB

This is strange, it seems like the command created two images for me? (this top image was not there before)

Why does this happen? is it simply the base image I am pulling from thta does this, and why would it do that?

0

Yes, the ubuntu:latest image is the base image, as specified by FROM ubuntu in your container file. The untagged image, 890bf2a53fe0, is the image created by docker build.

The base image is present because building on top of it involves pulling it; if you try building again you’ll notice that it doesn’t get pulled again, unless you remove it beforehand. See also the creation timestamps which give a hint as to which image was created by your docker build invocation.

2
  • So, the unnamed image is the onne that is created by me running build? what is the other docker image then created from? And how do I do what I want to, to create a single docker image which I can run? Sep 30 '21 at 13:24
  • The other Docker image is pulled from a remote repository. You have a single Docker image which you can run: docker run 890bf2a53fe0. Sep 30 '21 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.