Error executing RUN commands

I have several hours trying search wy happen this issue.

When i run a docker compose with a dockerfile with only calling
FROM php:7.4-fpm-alpine AS app_php

and after i enter to shell with exec manually and run “apk update” working good.

But if i put that command or whatever other in Dockerfile i get error.

FROM php:7.4-fpm-alpine AS app_php

RUN apk update

in image

Some idea what happend?

Is like the container was very slow and can execute that command because is no ready yet or the container dont have acces to networt resources.