如何删除docker镜像构建成功后留下的临时镜像?
看下面的: 7.3-fpm-alpine
是基础镜像,7.3-fpm_alpine_2020-03-28
是我构建出来的目标镜像,中间那么多个无名的镜像并且还很大,为什么会有这样的东西,并且无法删除?删除时报错:Error response from daemon: conflict: unable to delete 00ad77b9098b (cannot be forced) - image has dependent child images
.
php 7.3-fpm_alpine_2020-03-28 50bc85a6cc8f 16 minutes ago 521MB
<none> <none> 00ad77b9098b 17 minutes ago 521MB
<none> <none> 8725973170d7 17 minutes ago 521MB
<none> <none> a9f7ceab029f 17 minutes ago 521MB
<none> <none> 77507ec3a424 41 minutes ago 77.2MB
<none> <none> 4ed661333c43 41 minutes ago 77.2MB
<none> <none> 1a4ea387341c 41 minutes ago 77.2MB
<none> <none> f4be8002f88e 41 minutes ago 74.6MB
<none> <none> 22dddae2cdcd 41 minutes ago 77.2MB
php 7.3-fpm-alpine c127a826ef7f 4 days ago 74.6MB
我的dockerfile是这样写的,希望大神帮我指点一下:中间那么多个无名的镜像并且还很大,为什么会有这样的东西。
FROM php:7.3-fpm-alpine
MAINTAINER huangwh 306049836@qq.com
# 先把protobuf2.6下载到本地,然后copy进去。
COPY ./protobuf-2.6.1.tar.gz /tmp/protobuf-2.6.1.tar.gz
# 安装composer并允许root用户运行
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV COMPOSER_NO_INTERACTION=1
ENV COMPOSER_HOME=/usr/local/share/composer
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
&& apk --update upgrade \
&& apk add --no-cache libtool libmcrypt-dev freetype-dev libjpeg-turbo-dev autoconf rabbitmq-c rabbitmq-c-dev libcurl git libpng-dev gcc g++ make libcurl curl-dev libxml2-dev dpkg dpkg-dev imagemagick-dev zlib-dev libzip-dev libzip postgresql-dev bzip2-dev aspell-dev freetds-dev tidyhtml-dev libxslt-dev libintl musl-libintl icu-libs icu-dev \
&& pecl install amqp \
&& pecl install mongodb \
&& pecl install -o -f redis \
&& pecl install xdebug \
&& pecl install imagick \
&& pecl install mcrypt \
&& docker-php-ext-enable mcrypt redis amqp mongodb imagick \
&& docker-php-ext-install mysqli pdo pdo_dblib pdo_pgsql dba pdo_mysql mbstring bcmath zip bz2 opcache curl soap sockets tokenizer xml pcntl calendar exif gettext intl pgsql pspell shmop sysvmsg sysvsem sysvshm tidy wddx xsl\
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd \
&& rm -rf /var/cache/apk \
&& cd /tmp && tar zxvf protobuf-2.6.1.tar.gz\
&& cd protobuf-2.6.1 \
&& ./configure --prefix=/usr/local/protobuf \
&& make && make install \
&& export PATH=/usr/local/protobuf/bin:$PATH \
&& protoc --version \
&& cd /var/www/html && rm -rf /tmp/protobuf-2.6.1 \
&& mkdir -p /usr/local/share/composer \
&& curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
&& php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --snapshot \
&& rm -f /tmp/composer-setup.* \
&& composer config -g repo.packagist composer https://packagist.phpcomposer.com \
&& composer -V \
&& cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini \
&& echo "build successfulty!"
LABEL Author="ealson"
LABEL Version="php73_pb26"
LABEL Description="PHP 7.3.7 开发环境镜像."
# docker build -t php:7.3-fpm_alpine_2020-03-28 ./
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
另一个问题,这里镜像这么多,构建 完了的镜像其实就一个
7.3-fpm_alpine_2020-03-28
所以,这个为了构建出这个镜像,是不是占用的空间就是下面这些每个子镜像的占用空间之和?那这样可大了。。