Giter Club home page Giter Club logo

pgadmin4-docker's Introduction

pgAdmin 4

This is a simple Docker image for running pgAdmin 4 in a container. The default configuration is not intended for production use (it runs in "desktop mode", so authentication is disabled).

This image uses an unprivileged user, and uses port 5050 instead of 80. To access the web-interface on port 80 instead of 5050, you can map the port using -p 80:5050.

Example use

Quick start

To see this image in action, run the following command;

$ docker run --rm -p 5050:5050 thajeztah/pgadmin4

This starts a one-off container in non-detached mode, and container logs are printed in your terminal. After the container has finished starting, visit http://[your-docker-host]:5050 in your browser to try pgAdmin 4.

To exit and remove the container, press CTRL+C in your terminal.

Practical example

This example uses a custom network, and runs a PostgreSQL container.

# create a custom network for easier connecting
$ docker network create pg

# start a postgres container
$ docker run -d -e POSTGRES_PASSWORD=password --network=pg --name postgres postgres:9-alpine

# start pgAdmin container
$ docker run -d -p 5050:5050 --name pgadmin --network=pg thajeztah/pgadmin4

Now visit http://[your-docker-host]:5050 in your browser. You can add the postgres database (hostname is postgres, password is password) to test if everything is working.

screenshot

Persistent data

Persistent data is stored in a volume, located at /pgadmin/. This allows you to upgrade the container to a new version without losing configuration.

The following directories can be found inside the volume;

  • /pgadmin/config/pgadmin4.db - SQLite configuration database
  • /pgadmin/storage/ - other storage

You can override the storage location using the PG_ADMIN_DATA_DIR environment variable

Unprivileged user

pgAdmin runs as an unprivileged user (pgadmin) with uid:gid 1000:50. The uid:gid is selected for compatibility with Docker Toolbox, and allows you to bind-mount a local directory inside the container for persistent storage

For example, to bind-mount the /Users/me/pgadmin directory as storage directory;

$ docker run -d -p 5050:5050 -v /Users/me/pgadmin:/pgadmin thajeztah/pgadmin4

Run the image with a read-only filesystem

This image can be run with a read-only filesystem. To do so, specify the --read-only flag when starting the container.

$ docker run -d -p 5050:5050 --name pgadmin --read-only thajeztah/pgadmin4

Runtime configuration

This image can be configured at runtime, by setting environment variables;

  • PG_ADMIN_DATA_DIR directory to use for storing data (defaults to /pgadmin/)
  • PG_ADMIN_PORT port to listen on (defaults to 5050)
  • PG_ADMIN_SESSION_DIR directory to use for storing server-side sessions (defaults to /dev/shm/pgAdmin4_session)
  • DEBUG enable debug mode (detaults to False)

More information on pgAdmin 4 development can be found here;

Reporting issues and feature requests

Issues and feature requests can be reported on GitHub; https://github.com/thaJeztah/pgadmin4-docker

pgadmin4-docker's People

Contributors

chrisob avatar emanuelmutschlechner avatar graphaelli avatar madflow avatar thajeztah avatar vitaliytv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pgadmin4-docker's Issues

COPY from CSV does not work

When trying to import data from a CSV file I'm able to upload my CSV to a /tmp location inside the container, but running the import itself with this file selected produces the following errors in the status:

Error loading shared library libedit.so.0: No such file or directory (needed by /usr/local/bin/psql)
Error relocating /usr/local/bin/psql: stifle_history: symbol not found
Error relocating /usr/local/bin/psql: rl_completion_matches: symbol not found
Error relocating /usr/local/bin/psql: add_history: symbol not found
Error relocating /usr/local/bin/psql: write_history: symbol not found
Error relocating /usr/local/bin/psql: read_history: symbol not found
Error relocating /usr/local/bin/psql: rl_filename_completion_function: symbol not found
Error relocating /usr/local/bin/psql: current_history: symbol not found
Error relocating /usr/local/bin/psql: readline: symbol not found
Error relocating /usr/local/bin/psql: previous_history: symbol not found
Error relocating /usr/local/bin/psql: using_history: symbol not found
Error relocating /usr/local/bin/psql: rl_initialize: symbol not found
Error relocating /usr/local/bin/psql: history_set_pos: symbol not found
Error relocating /usr/local/bin/psql: next_history: symbol not found
Error relocating /usr/local/bin/psql: rl_attempted_completion_function: symbol not found
Error relocating /usr/local/bin/psql: rl_line_buffer: symbol not found
Error relocating /usr/local/bin/psql: rl_readline_name: symbol not found
Error relocating /usr/local/bin/psql: rl_basic_word_break_characters: symbol not found

where are the logs?

where can i see the logs ?
i use bash inside the container and i see
these directories
bin etc lib mnt proc run srv tmp var
dev home media pgadmin root sbin sys usr

but i dont know where can i see the logs erros

Inclusion of postgresql in image

First, thanks for this repo and Dockerfile. Super useful.

Just wanted to ask if it was an intentional choice to not include a postgresql installation with this image. I wanted to have this so that the pg_dump and pg_restore binaries are available to be able to run those commands from pgadmin4. I have just added on my local repo and it builds/works fine by filling in the binary paths in the app settings.

Also, the current version of alpine that this image is based on only has a postgres 9.5 compatible postgresql package in its repo. Whereas python:2-alpine3.6 has the pg9.6 package. The latest release.

I'm happy to make a PR with the changes and update the README accordingly. But I also understand if the intention was to keep the image small and minimal.

How to switch off debugging mode?

Hi Sebastiaan,

hope all is well.

How can I disabled SQL logs in docker container? When I open dashboard in browser, I always can see SQL like

SELECT
    (SELECT count(*) FROM pg_stat_activity) AS "Total",
    (SELECT count(*) FROM pg_stat_activity WHERE state = 'active')  AS "Active",
    (SELECT count(*) FROM pg_stat_activity WHERE state = 'idle')  AS "Idle"

in console.

Have a nice day!

Enable hosting in subdirectories

When using this in a more complex project I use Nginx to bind multiple composed containers together, ie. in my application I have for example /admintools/grafana, /admintools/rabbitmq, /admintools/mongo-express and /admintools/phpmyadmin. Unlike these tools however PgAdmin4 insists on taking control of the path, and I see no (easy) way to override it. When using this container it just redirects me to /browser, giving me a 404 of my own application.

In an ideal world I'd just pass an env variable PGADMIN_PATH_PREFIX=/admintools/pgadmin. Can my world become that ideal? ๐Ÿ˜‰

It should be noted that the /admintools virtual folder is secured at the Nginx level, so I'd also want to disable authentication. Surfing to /admintools/pgadmin should, if allowed by Nginx, just show me the application database right away.

Configure connection on startup

Good morning.

I was wondering if is it possible somehow to automatically configure a connection to a database on pgadmin startup.

Thanks.

Can't add new server

How can I add a new server to the pgAdmin? I use host ip 172.17.0.2 and port 5050, but seems it doesn't working

โฏ docker run --rm -p 5050:5050 thajeztah/pgadmin4

NOTE: Configuring authentication for DESKTOP mode.

pgAdmin 4 - Application Initialisation

Starting pgAdmin 4. Please navigate to http://0.0.0.0:5050 in your browser.

I use default credentials (hostname is postgres, password is password)

screenshot-82

screenshot-83

Unable to run as a service

version: "3"
services:
  pgadmin:
    image: fenglc/pgadmin4
    stdin_open: true
    tty: true
    ports:
      - "5050:5050"

Browser waits forever when trying to connect to localhost:5050

An example for tunneling support

HI.

Sometimes DB servers are hidden from the outside world and can be reached only within ssh tunnels. This docker image doesn't see my local tunnel set up in advance, therefore I cannot open a connection from pgadmin running inside docker.

Can you please add the example of docker network configuration or command line string for this image to support local tunnels?

Thanks.

[Noob Question] - Which host do you use inside pgAdmin to connect to the DP? (in your 'Practical example')

I wasn't able to connect to the database when specifying the host as localhost or 0.0.0.0. What value to you put in that field?

I was able to get everything to work if I used --net="host", however. But no luck with --net pg as in your instructions from 'Practical example'

I'm not sure if this is the same issue as is spoken about here: #12 ?

But thanks for sharing this, super useful ๐Ÿ‘

separate doc for more standard setup

I see you ran docker network create...
but this is not standard way people run docker containers

Any way of adding a typical/standard docker run ... command for simplicity?

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.