Skip to content

mschirdel/postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PostgreSQL Server

Prerequisites: Docker Engine.

Run the Server

check the docker-compose.yaml if you'd need to have different username and password and db name other than My* please edit those. To run the server then you need this command. $ docker-compose up

If this is the first time using Docker, install the Docker Desktop.
Check your Docker Desktop version by clicking the the Docker Desktop icon in the taskbar to show the drop-down menu, and open About Docker Desktop.
This will show the Docker Desktop version in the middle of the window, the Engine version below, and other version numbers.
Compare your version numbers to the following:

  • Recommended Docker Desktop version: 2.1.0
  • Recommended Engine version: 19.03

If you have version(s) lower than the above version numbers, update Docker Desktop. This can easily be done by clicking the Docker Desktop icon in the taskbar to show the drop-down menu, then Check for Updates.

Some Docker Tips

  • Stop a container:
    • Use docker ps to list running containers.
    • Copy the name of the Image (under the Names column)
    • Use the Terminal command docker stop your-image-name
    • When the container is successfully stopped, Docker will print the name of the Image in the terminal
  • Remove unused containers:
    • Use the Terminal command docker system prune (followed by y to confirm) to remove all of the old and unused containers.
    • It is recommended you do this after docker stoping a container
    • This will NOT remove the Images, which means you only need to enter your specific docker run ... command that you used in Run Server Docker Image when you want to use the simulator again.
  • List images built successfully: use the Terminal command docker images.
  • If your container is spontaneously dying, it may be due to the memory allocation given to Docker.
    • Docker Desktop -> Preferences -> Advanced and adjust the slider settings to allow Docker to use more resources.

Example of Stopping Docker Container

  • docker ps: list running containers
  • copy the simserver container named nifty_murdock listed in the last column, Names
  • docker stop nifty_murdock: stops the container
  • docker system prune then y when asked to confirm: deletes old container and reclaims space (Terminal responses are green)
    username:/ username$ docker ps
+    CONTAINER ID      IMAGE        COMMAND              CREATED          STATUS          PORTS                      NAMES
+    119de3df985d      simserver    "python server.py"   14 seconds ago   Up 12 seconds   0.0.0.0:5000->5000/tcp     nifty_murdock

    username:/ username$ docker stop nifty_murdock
+    nifty_murdock

    username:/ username$ docker system prune
+    WARNING! This will remove:
+    - all stopped containers
+    - all networks not used by at least one container
+    - all dangling images
+    - all dangling build cache

    Are you sure you want to continue? [y/N] y
+    Deleted Containers:
+    119de3df985ddce4bee7d12899896ec66a72c9768cebe347df8303eba38e71ad

More Info on Docker Image with Postgres

<https://linuxhint.com/run_postgresql_docker_compose/>

About

simple build postgres server in docker !

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors