Using docker in adminer I do not see imported data

Viewed 698

I created docker container with postgres and adminer with options:

lprods_db:
    image: postgres:9.6.10-alpine
    ports:
        - '5433:5432'
    restart: always
    environment: 
        POSTGRES_USER: 'postgres'
        POSTGRES_PASSWORD: '1'
        POSTGRES_DB: 'wprods'
    volumes:
        - ./init:/docker-entrypoint-initdb.d/


lprods_adminer:
    image: adminer
    restart: always
    ports:
        - 8083:8080
    links:
        - lprods_db

I need to upload my dump into wprods db of my lprods_db instance I run in console of my OS :

cat  /mnt/_work_sdb8/wwwroot/lar/lprods/__SQL/wprods_2017_10_23.sql   | docker exec -i   lprods_docker_lprods_db_1    psql -Upostgres

where /mnt/_work_sdb8/wwwroot/lar/lprods/__SQL/wprods_2017_10_23.sql is sql dump in my OS path and lprods_docker_lprods_db_1 - db container

I saw long output of commands of postgres importing data without errors, like :

CREATE INDEX
ALTER TABLE
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
ALTER TABLE
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
CREATE INDEX
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
REVOKE
REVOKE
GRANT
GRANT

By opening adminer at http://127.0.0.1:8083/ I did not find any tables in specified db : https://imgur.com/a/n6Tk4YE I expected my data would be imported into wprods.public. Is it so? What is wrong?

Are there some FLUSH command could be used here?

Thanks!

1 Answers

Your docker-compose.yml and the commands you use seem fully correct - I started up everything at first try.

The only seeming pitfall here is that pg_dump's output doesn't know anything about the database name. From the docs:

Script dumps are plain-text files containing the SQL commands required to reconstruct the database

So when you restore it via psql you need to explicitly specify the target database name, in your case the command would look like

cat /mnt/_work_sdb8/wwwroot/lar/lprods/__SQL/wprods_2017_10_23.sql | docker exec -i lprods_docker_lprods_db_1 psql -Upostgres wprods

otherwise you'll populate the default postgres database

Related