Using COPY table FROM PROGRAM 'curl "www.example.com/data.csv"';
I am able to copy a CSV directly from the web into a psql table.
However, when I am running the same command from inside a docker container I get the following error:
COPY sites FROM PROGRAM 'curl "www.example.com/data.csv"';
ERROR: program "curl "www.example.com/data.csv"" failed
DETAIL: command not found
Obviously curl is not available in the containerized environment. Therefore I changed my Postgres Docker image from image: postgres:12-alpine
to image: postgres-12
. Unfortunately I still get the same error.
How can include the curl
command in a containerized PostgreSQL Docker environment?
This is my docker-compose file:
version: '3.7'
services:
web:
build:
context: ./services/web
dockerfile: Dockerfile.prod
command: gunicorn --bind 0.0.0.0:5000 manage:app
volumes:
- static_volume:/home/app/web/project/static
- media_volume:/home/app/web/project/media
expose:
- 5000
env_file:
- ./.env.prod
depends_on:
- db
db:
image: postgres:12
volumes:
- postgres_data:/var/lib/postgresql/data/
env_file:
- ./.env.prod.db
nginx:
build: ./services/nginx
volumes:
- static_volume:/home/app/web/project/static
- media_volume:/home/app/web/project/media
ports:
- 1337:80
depends_on:
- web
Include curl commands in a PostgreSQL Docker environment
volumes:
postgres_data:
static_volume:
media_volume: