The error message you're encountering indicates that the psql command is not found in your application container. This is likely because the PostgreSQL client tools are not installed in the container where you're trying to run the migration. Here's how you can resolve this issue:
-
Install PostgreSQL Client Tools in the Application Container:
You need to ensure that the PostgreSQL client tools are installed in your application container. You can do this by modifying your Dockerfile or by directly installing it in the running container.
If you have access to the Dockerfile for your application container, you can add the following line to install the PostgreSQL client:
RUN apt-get update && apt-get install -y postgresql-clientIf you want to install it directly in the running container, you can execute the following command:
sudo docker exec -ti app bash -c "apt-get update && apt-get install -y postgresql-client" -
Verify the Installation:
After installing the PostgreSQL client, verify that
psqlis available by running:sudo docker exec -ti app psql --versionThis should output the version of the PostgreSQL client, confirming that it is installed.
-
Retry the Migration:
Once the PostgreSQL client is installed, try running your migration command again:
sudo docker exec -ti app php artisan migrate
By ensuring that the PostgreSQL client tools are installed in your application container, the psql command should be available, and your migration should proceed without the "command not found" error.