This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
dev:web:psql_docker [2023/03/03 11:21] – initial mb | dev:web:psql_docker [2023/03/03 12:21] (current) – mb | ||
---|---|---|---|
Line 7: | Line 7: | ||
===== create dockerfile and container ===== | ===== create dockerfile and container ===== | ||
- | <Code: shell linenums:1 |Dockerfile> | + | firstly we create a dockerfile using the postgres docker image and copying the exported database into the new image. \\ |
+ | <Code: shell linenums:1 | Dockerfile> | ||
COPY fsidb_bac.sql / | COPY fsidb_bac.sql / | ||
+ | to build the dockerfile use: <Code: shell linenums: | ||
+ | With //docker images// all locally saved images are shown and fsidbpostgresql: | ||
+ | Now we start the container using: | ||
+ | <Code: shell linenums: | ||
+ | Make sure the port isn't already used on your docker hostsystem, if so you can bind 5432 onto another port of the hostsystem. \\ | ||
+ | ===== import database in container ===== | ||
+ | Firstly connect to the shell of the docker container. All containers can be listed with //docker container ls -a//. | ||
+ | <Code shell linenums: | ||
+ | Before importing the fsidb_bac.sql a new database has to be created. Usercreation is optionally. \\ | ||
+ | Start postgresql client: | ||
+ | <Code shell linenums: | ||
+ | Create a new database with sql statement: | ||
+ | <Code sql linenums: | ||
+ | Quit the postgresql client with **\q** \\ | ||
+ | Import the database as following: | ||
+ | <Code shell linenums: |