Git Product home page Git Product logo

phppgadmin-docker's Introduction

Automated build of phpPgAdmin with Docker

Apache and Postgres environment variables

Apache and Postgres will make of the following environment variables.

POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DEFAULTDB=defaultdb
APACHE_SERVERNAME=localhost
APACHE_SERVERADMIN=admin@localhost
APACHE_DOCUMENTROOT=/var/www
APACHE_RUN_USER=www-data
APACHE_RUN_GROUP=www-data
APACHE_LOG_DIR=/var/web/log/apache2
APACHE_PID_FILE=/var/run/apache2.pid
APACHE_RUN_DIR=/var/run/apache2
APACHE_LOCK_DIR=/var/lock/apache2

Use the pre built image

The pre built image can be downloaded using docker directly. After that you do not need to use this command again, you will have the image on your machine.

$ sudo docker pull jacksoncage/phppgadmin

Build the docker image by yourself

If you prefer you can easily build the docker image by yourself. After this the image is ready for use on your machine and can be used for multiple starts.

$ cd phppgadmin-docker
$ sudo docker build -t jacksoncage/phppgadmin .

Start the container

The container has all pre requisites set up to run phpPgAdmin. Specify all needed environment variables.

$ sudo docker run -i -d -p 80 -e APACHE_SERVERNAME=jacksoncage.se -e POSTGRES_HOST=localhost -e POSTGRES_PORT=5432 jacksoncage/phppgadmin

Trying the browser on url http://localhost/phppgadmin.

Start the container and keep control

The command above starts the container in deamon mode (-d) and runs in the background. If you want to start it by yourself just to see what happens use this command:

$ sudo docker run -i -t -p 80 -e APACHE_SERVERNAME=jacksoncage.se -e POSTGRES_HOST=localhost -e POSTGRES_PORT=5432 jacksoncage/phppgadmin bash

Notice the two changes made here, first we replaced the deamon switch (-d) with the tty switch (-t) which pipes the std in and std out to your terminal.

You now end up as a root user in the docker container and can do simple things like ls, cd and more. More complex things can be achieved after a apt-get install of one or more software(s) of choice.

Get the container ip and port

The first command inspects your created container and get the IPv4 address. Second command docker exported port for 8080.

$ sudo docker inspect <container_id> | grep IPAddress | cut -d '"' -f 4
$ sudo docker port <container_id> 80 | cut -d ":" -f2

Now go to <your container's ip>:<container's port> in your browser

Stop the container

Stopping a running container is possible via the docker api. If only one instance of this container is running this command will stop it:

$ sudo docker stop `sudo docker ps |grep jacksoncage/phppgadmin |cut -d\  -f1`

phppgadmin-docker's People

Contributors

jacksoncage avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.