How to load a database with docker?


I’m a beginner in docker and for my first pratice i have to load a database and exercise myself on it.

So i have created a contener with :

docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres

Then i have connected a client on it with :

docker run -it --rm --link some-postgres:postgres postgres psql -h postgres -U postgres

Now i have to copy this file “base-northwind-postgresql-from-csv.sql” and in northwind_csv there is all the .csv files i need

How can i copy these in the container with docper cp ?

Then i just have to run in the client ?

\i base-northwind-postgresql-from-csv.sql

Thanks for your help

You need to use a volume to mount the host folder into a container folder: