How to force Docker for a clean build of an image

后端 未结 9 948
情书的邮戳
情书的邮戳 2021-01-29 17:12

I have build a Docker image from a Docker file using the below command.

$ docker build -t u12_core -f u12_core .

When I am trying to rebuild it

9条回答
  •  天涯浪人
    2021-01-29 17:44

    The command docker build --no-cache . solved our similar problem.

    Our Dockerfile was:

    RUN apt-get update
    RUN apt-get -y install php5-fpm
    

    But should have been:

    RUN apt-get update && apt-get -y install php5-fpm
    

    To prevent caching the update and install separately.

    See: Best practices for writing Dockerfiles

提交回复
热议问题