I would like to load data from CSV file into PostgreSQL database in Docker. I run:
docker exec -ti my project_db_1 psql -U postgres
Then I select my database:
\c myDatabase
Now I try to load data from myfile.csv
which is in the main directory of the Django project into backend_data
table:
\copy backend_data (t, sth1, sth2) FROM 'myfile.csv' CSV HEADER;
However I get error:
myfile.csv: No such file or directory
It seems to me that I tried every possible path and nothing works. Any ideas how can I solve it? This is my docker-compose.yml:
version: '3'services:db:image: postgresenvironment:POSTGRES_USER: myuserPOSTGRES_PASSWORD: mypassworddjango:build: .command: python3 manage.py runserver 0.0.0.0:8000volumes:- .:/codeports:- "8000:8000"depends_on:- db