A
A
Alexander Nazarov2017-10-06 19:05:24
linux
Alexander Nazarov, 2017-10-06 19:05:24

Why are two separate images created in Docker?

I have created a Dockerfile, building an image using a Dockerfile.

[email protected]:/var/lib/docker/Source# sudo docker build -t obraz .

As a result, on command: docker imagesI get two separate images.
59d7a923d62c2942723244.png
But if you get an image from the Docker hub ( docker pull obraz ), then docker images
only one is displayed on command.
59d7a99b7db42111401705.png
Dockerfile:
FROM   ubuntu:16.04
ENV    DEBIAN_FRONTEND noninteractive
RUN    apt-get --yes update; apt-get --yes upgrade; apt-get --yes install software-properties-common
RUN    sudo apt-add-repository --yes ppa:webupd8team/java; apt-get --yes update
RUN    echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections  && \
       echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections  && \
       apt-get --yes install curl oracle-java8-installer ; apt-get clean

RUN    chmod +x /start
EXPOSE 80
VOLUME ["/data"]
CMD    ["/start"]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-10-06
@wergio

In the first case, you collect the image on your computer. The first line in your dockerfile says that the image is based on the ubuntu:16.04 image, so it is first downloaded and then used to build the image. In the second case, you do not build the image on your computer, but download the finished one from the dockerhub.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question