How to install docker and deploy postgres docker image using LinuxONE Community Cloud

Running postgresql on docker

Prerequisites

  1. Request access to LinuxONE Community Cloud. Follow instructions here

Step 1: Install docker

1.1 install docker

# sudo yum install docker 

1.2 Ensure docker installed by checking version

# sudo docker version

alt text

Step 2: Download Postgres image

2.1 Pull postgres docker image

# sudo docker pull postgres:latest

alt text

2.2 List docker images

# sudo docker images

alt text

Step 3:Running Postgres docker images

3.1 Run postgres docker image as a container

# docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres

alt text

3.2 After succesfully running last command, you can now check the running container

# docker ps

alt text

3.3 Now you can execture Postgres container

# docker exec -it some-postgres bash

alt text

3.4 connect to postgresql using user postgres

# psql -U postgres

alt text