Docker-php-ext-install vs apt install?

I’m trying to install pdo-mysql to PHP container
I tried to install it using command line as:

    apt install pdo pdo_mysql

but the extension not installed and provide a lot of errors.

But When I use

docker-php-ext-install pdo pdo_mysql

The extension was installed successfully

So what is the difference between them, and when must just each of them.