How to copy production database locally login to remote server, and get into postgres container via: docker-compose -f production.yml exec postgres /bin/bash scp the backup from the server if restoring to local env: pg_dump -U $POSTGRES_USER -d smart -f smart.sql mv smart.sql docker-entrypoint-initdb.d/ move smart.sql to ~ and copy the dump using scp scp smart:smart.sql . Modify the smart.sql file add the lines DROP SCHEMA PUBLIC cascade;CREATE SCHEMA PUBLIC; to the top. replace the user with 'postgres' add users: CREATE ROLE smart_anonymous; CREATE ROLE smart_user; stop the docker containers. remove all containers, and delete all volumes. docker container prune -f docker volume prune -f Move the file into postgres folder. docker-compose up postgres delete the smart.sql file