Download Postgresql Docker Image

/ Comments off
  1. What Is Docker
  2. Download Postgresql Docker Image File
  3. Docker Hub
  4. Download Postgresql Docker Image Download
  5. Download Postgresql Docker Image For Windows 10
  6. Docker Image Vs Container

Working with Docker images. Relational database services for MySQL, PostgreSQL, and SQL server. To download a signed container image, you should have Docker installed and use the. Docker Hub is the world's easiest way to create, manage, and deliver your teams' container applications. Get Started Today for Free. The Spring Boot Docker image has the name docker-spring-boot-postgres:latest (line 5). Docker builds that image from the Dockerfile in the current directory (lines 6-7) The container name is app (line 8). It depends on the db service (line 10). That's why it starts after the db container.

# Start empty Ubuntu container
docker run -it ubuntu bash

# Show current Ubuntu version
lsb_release -a

What Is Docker

(See instruction detail from http://www.postgresql.org/download/linux/ubuntu/)

vi /etc/apt/sources.list.d/pgdg.list
deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main

apt-get install wget
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc sudo apt-key add -

apt-get update

apt-get install postgresql-9.4 postgresql-client-9.4 postgresql-contrib-9.4

exit

### DOCKER COMMIT PH1 ###
docker commit postgresql nutthaphon/postgresql-9.4

-- Place data on VirtualBox folder sharing ** NOW not working
docker run -it -v /cygdrive/d/TEMP/postgresdata:/data nutthaphon/postgresql-9.4 bash



Download postgresql docker image for windows 10-- Place data on Docker volume (Union Filesystem) see more.
docker create -v /data --name postgresdata ubuntu
docker run -it --name postgres_service --volumes-from postgresdata nutthaphon/postgresql-9.4 bash


cd /etc/postgresql/9.4/main
cp pg_hba.conf /data/pg_hba.conf

sed -i '/^data_directory*/ s /var/lib/postgresql/9.4/main /data/main ' postgresql.conf
sed -i '/^hba_file*/ s /etc/postgresql/9.4/main/pg_hba.conf /data/pg_hba.conf ' postgresql.conf
sed -i '/^ident_file*/ s /etc/postgresql/9.4/main/pg_ident.conf /data/pg_ident.conf ' postgresql.conf
mkdir -p /data/main
mkdir -p /var/run/postgresql/9.4-main.pg_stat_tmp
chgrp postgres /data/*
su postgres --command '/usr/lib/postgresql/9.4/bin/initdb -D /data/main'


sed -i '/^#listen_addresses/i listen_addresses='*' postgresql.conf
sed -i '/^# DO NOT DISABLE!/i # Allow access from any IP address' pg_hba.conf
sed -i '/^# DO NOT DISABLE!/i host all all 0.0.0.0/0 md5nnn' pg_hba.conf


#### Startup database
su postgres --command '/usr/lib/postgresql/9.4/bin/postgres -D /data/main -c config_file=/data/postgresql.conf' &

#### Shutdown database
su postgres --command '/usr/lib/postgresql/9.4/bin/pg_ctl --pgdata=/data/main stop'



### Create database
su postgres --command 'createuser -P -d -r -s docker'
su postgres --command 'createdb -O docker docker'

Download Postgresql Docker Image File



### DOCKER COMMIT PH2 ###

Docker Hub

docker commit postgres_service nutthaphon/postgresql-9.4:first_use


### Upload to Docker Hub
docker login --username=nutthaphon [email protected]
docker push nutthaphon/postgresql-9.4:first_use

### Start PostgresSQL container
docker run -it --name postgres_service --volumes-from postgresdata -d -p 5432:5432 nutthaphon/postgresql-9.4:first_use su postgres --command '/usr/lib/postgresql/9.4/bin/postgres -D /data/main -c config_file=/data/postgresql.conf'

Download Postgresql Docker Image Download





### Test connect to docker database with pgAdminIII

Download Postgresql Docker Image For Windows 10

new connection

pgAdminIII

Docker Image Vs Container


****** Some of instruction come from Amattn.comandDocker.com