Install Docker (on linux) or Docker-toolbox (on Windows/Mac)
Linux only: Use docker without sudo
- Open a terminal (Docker Quickstart Terminal on Windows/Mac or standard terminal on Linux).
- Download zip and unzip or “git clone” from OptiquePostgres repository
$ git clone https://github.com/madgik/Docker-OptiquePostgres.git
- Linux only:
$ sudo service docker start
- Navigate to the Stream Server Directory:
$ cd <path to Docker-OptiquePostgres>
- Windows only
$ dos2unix docker-entrypoint.sh
- Build Stream Server image (this may take a few minutes the first time):
$ docker build -t postgresserver .
- Execute:
$ docker run -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -i -t --rm --name postgresserver postgresserver
- The "-e POSTGRES_PASSWORD=mysecretpassword" argument is optional.
- To change the port the container listens to you need to change the first part of the "-p :5432" argument.
- Leave this console open while you are working and then stop the container.
- Find your docker machine IP
- On Linux is: localhost
- On Windows/Mac open a new Docker Quickstart Terminal and run:
$ docker-machine ip
It will return your docker-machine ip (from now on use this instead of localhost if you are on Windows or Mac).
- The postgres server inside the container has one database named "ns"
- The default user will be "postgres" and a password can be set but it is optional
Test the Optique Postgres using psql
$ psql -p 5432 -U postgres -h <dockerip>
To gracefully stop your docker container:
- Select your Optique Postgres docker console.
- Press Ctrl+C.
- Close the console.
To load your dataset into the postgres database of the container:
- Create a sql script file and save it in the same directory as the Dockerfile of this repository
- Modify the Dockerfile of this repository and after the line
RUN mkdir /docker-entrypoint-initdb.d
you must add your script file to the container
ADD <name-of-your-script-file> /docker-entrypoint-initdb.d/