Apt update returning error code on container

213 Views Asked by At

Folks! I have used Slim Framework on a container based on this article: https://dev.to/cherif_b/using-docker-for-slim-4-application-development-environment-1opm I simply download the project from Github (https://github.com/cherifGsoul/slim-from-scratch/tree/development-environment-part-2), compose the containers according to article's instructions (docker-compose up -d --build) and start to create my API inside that. It have worked fine for the first time. But, since a remove the containers (and images) e tried to compose it again, i'm facing an intriguing problem: the "apt update" command (on Dokerfile) simply do not work animore! It returns an error message like:

E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true'
#6 21.17 E: Sub-process returned an error code
------
executor failed running [/bin/sh -c apt update   && apt install -y zlib1g-dev g++ git libicu-dev zip libzip-dev zip libpq-dev     && docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql     && docker-php-ext-install intl opcache pdo pdo_pgsql     && pecl install apcu     && docker-php-ext-enable apcu     && docker-php-ext-configure zip     && docker-php-ext-install zip]: exit code: 100
ERROR: Service 'php' failed to build : Build failed

In order to Troubleshoot this, i tried without success:

  • To use "apt-get" instead "apt";
  • To call "docker compose" instead of "docker-compose";
  • To use root privileges;
  • To restart, to reset to factory default and to reinstall the Docker Desktop (4.1.0 on Macos Catalina);
  • To execute "docker run -it php:8.1-fpm" and so execute "apt update" on the container. That shows the sabe message I reproduce above.

Would somebody of you, please, have any hint about this problem? I would really appreciate any help! Thanks in advance!

1

There are 1 best solutions below

0
Justace Clutter On

You might want to check out the "--privileged" flag for docker. I can run that line of code if I start a docker container with this. If I do not use that flag, I get that error.

I know this is not a fix for a docker build process, but it is a clue for the root problem.