Docker Automatic Containers after RUN on Dockerfile

Asked

Viewed 35 times

0

A Doubt about the dockerfile:

After I run the build it creates some containers with < None >tag, is that normal? You shouldn’t only create php?

FROM php:7.2-apache

RUN apt-get update && \
      apt-get install -y --no-install-recommends \
      apt-utils \
      curl \
      libmemcached-dev \
      libz-dev \
      libpq-dev \
      libjpeg-dev \
      libpng-dev \
      libfreetype6-dev \
      libssl-dev \
      libmcrypt-dev\
      libpq-dev \
      mysql-client

RUN a2enmod rewrite

RUN docker-php-ext-install pdo pdo_mysql

# COPY 000-default.conf /etc/apache2/sites-available/000-default.conf

# install GD

RUN docker-php-ext-install gd && \
      docker-php-ext-configure gd \
      --with-jpeg-dir=/usr/lib \
      --with-freetype-dir=/usr/include/freetype2 && \
      docker-php-ext-install gd

List of created containers:

❯ docker images -a
REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
<none>              <none>              1ddab69ed614        15 seconds ago       463MB
<none>              <none>              6de0de8461cd        About a minute ago   378MB
php                 7.2-apache          1d7b7e0dfca8        2 days ago           378MB

If I just run Docker images, only php appears, but I can’t remove these < None >containers, because it seems that they are linked to php.

Thanks

  • docker images -a >> Show all images (default Hides Intermediate images). From what I saw are intermediate images created at build time.

  • Yes I know, what I want to know is if it is normal to create two images < None >.. because if I only run a Docker pull php7.2-apache it creates only php without extra containers.

  • No build if you use the --rm it will not create it. Now this amount may be something related to layers of your image. I’ll run some tests to confirm you :)

  • Try to give a docker history php:7.2-apache and add the output, to see if it matches the amount of layers

  • And gives a read in that article, will help clarify a little

  • From what I read, these images < None > are parts of the created container, I just found it strange that when I use Docker pull php7.2-apache these < None >are not created >??

  • So, as you build on your machine every layer it generates, it saves there, when you pull it, you just download the dry image. That’s why the recommendations about writing lean Dockerfiles, not to generate so many layers.

  • Complementing: the Docker hub Registry should manage this issue of images <None>, for when do pull download only the final image.

  • Tried to remove using the article command? (docker rmi $(docker images -f "dangling=true" -q))

  • not removed because only appears in Docker images -a

Show 5 more comments

1 answer

0

this is normal, the first column of None is saying that it has a repository that means that you created (build) but did not associate to the Docker Hub repository for example, the second column was that you did not pass a tag value to identify the image so it was None.

I’d say you just turned the remote docker build .

has how to pass the example values how to pass a tag

docker buil . -t meudiretorio/minhaimagem:1.1

documentation link

https://docs.docker.com/engine/reference/commandline/build/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.