1

I created ./docker/app/Dockerfile with sth like this:

FROM php:7.3-apache
RUN a2enmod rewrite
RUN docker-php-ext-install pdo_mysql && docker-php-ext-enable pdo_mysql
(...)

My docker-compose:

  app:
    build: './docker/app/'
    image: php:7.3-apache
    ports:
      - 80:80
    volumes:
    (...)

I'm trying to build clean instance of my container. I wish it will look like first build (I want to test if my Dockerfile is ok and will install all required packages). But after making command: docker-compose build app I see warnings like:

Module rewrite already enabled
warning: pdo_mysql (pdo_mysql.so) is already loaded!

Commands docker-compose build --force-rm app and docker-compose build --force-rm --no-cache app works the same. Packages installed once still persists and my Dockerfile's commands has no sense during the build.

So I have 2 questions:

1) How to build new clean version of my app container from scratch?

2) What commands docker-compose build and docker-compose build --force-rm are for if they don't build new image?

1 Answer 1

1

try to reforce the build using:

docker-compose up -d --force-recreate

or delete every thing before you build:

docker-compose rm
docker image prune
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.