Skip to content

MugTree/docker-postgres-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic go application dockerised with a persistent postgres container

Db is created on init using the commands from the seed-data folder and will persist over stop and starts.

To interact with the db from the host machine - If you look in the docker-compose.yml you'll see that there is a port mapping that respects that postgres might be running on the host.

So to connect to to postgres container something like

         psql -h localhost -p 5433 -d postgres -U postgres -W

Fiddled around with creating a new database and a new user in the initalisation stage and couldn't seem to get it working. The db command kept getting run against the default database so settled with using the postgresdb postgres user combination.

Useful commands

        docker compose up -d
        docker compose down
        docker network prune

Rebuild

        docker compose up -d --build

Follow logs real-time:

        docker-compose logs -f

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors