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.– Tuxpilgrim
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.
– Alexandro Zaleski
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 :)– Tuxpilgrim
Try to give a
docker history php:7.2-apache
and add the output, to see if it matches the amount of layers– Tuxpilgrim
And gives a read in that article, will help clarify a little
– Tuxpilgrim
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 >??
– Alexandro Zaleski
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.
– Tuxpilgrim
Complementing: the Docker hub Registry should manage this issue of images <None>, for when do pull download only the final image.
– Tuxpilgrim
Tried to remove using the article command? (
docker rmi $(docker images -f "dangling=true" -q)
)– Tuxpilgrim
not removed because only appears in Docker images -a
– Alexandro Zaleski