Tag: postgresql

Docker: Reconnect new postgres container to existing Data container

I have 3 docker containers. One running django, another running postgres and third is a data container for the postgres. I’m using docker-compose to link them up. docker-compose.yml dbdata: image: postgres container_name: dbdata_container volumes: – ./data:/var/lib/postgresql/data command: true db: image: postgres container_name: postgres_container ports: – “5432:5432” volumes_from: – dbdata web: build: . container_name: django_container command: […]

Docker, install postgresql in a container contain “ubuntu:14.04”, lost when out of the container

I tried to install postgresql-9.3 in the container contains images “ubuntu: 14:04″ The first step, which I did make images “ubuntu: 14:04” $ sudo Docker pull ubuntu:14.04 The second step, I create a container with the command $ sudo docker run -t -i ubuntu:14.04 /bin/bash The third step, I install postgresql-9.3 in a container contain […]

Restore a Postgresql database into a Docker container so when Postgres starts up the DB is in place

I have a Postgresql data dump file. How can I restore that backup into a data only container in the way that the restore is in place when I docker run the postgresql container?

Run docker image with docker-compose

I have my simple app in C# that connect with postgreSQL. I would like to create image with this app and just run with docker. Everything is ok when I use: $ docker build $ docker run postgres $ docker run my_app Additionally, there is everything ok, when I use compose from application directory: $ […]

How to pass host IP as environment variable when running a docker container on OS X

I have a docker image and when I run it I need to pass the host machine IP address as an environment variable. So I need something like this: docker run –rm -it -e HOST_IP=<?????> -p 8000:8000 image I am using Docker on OS X. Basically this image is running a service that I want […]

Docker Entrypoint for Postgres 9.3

This is my Dockerfile for installing Postgres. # Set the base image to Ubuntu FROM ubuntu:14.04 # Update the repository sources list RUN apt-get update -y ################## BEGIN INSTALLATION ###################### # Install wget RUN apt-get install wget -y # Setup Postgres repository RUN wget –quiet -O – https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add – # Add […]

Django, Postgres, Docker – Can not run migrations on database on ubuntu 14.04 python 2.7.11

I’m using the same docker-compose file to run an environment with django and postgresql. When I run the environment on my local virtual machine (using docker-machine virtualbox driver and boot2docker distribution) and run migrations or tests it all works. Deploying the exact same environment to digitalOcean running ubutu 14.04 I can’t run migrations or tests. […]

How to access my local system Postgres from Docker

When I use Docker on my own machine, I want to access my system’s Postgres. This is prior to deploying my images to AWS, where I want to use RDS. I have followed the steps on Docker’s Quickstart: Docker Compose and Rails page with the exception that, because I was working with an existing application, […]

How to recover data from a deleted Docker container? How to reconnect it to the data?

Let’s say, I delete a PostgreSQL docker container which had its data only here: $ docker inspect postgres1 … “Source”: “/var/lib/docker/volumes/4948af…./_data” “Destination”: “/var/lib/postgresql/data” $ docker rm postgres1 If there was no other container referencing the volume, I cannot reconnect to this volume with –volumes-from any more, even though the files are still on disk somewhere […]

Change Ubuntu locale in Docker

So I’m setting up a docker image with Ubuntu and Postgresql in pt_BR and I’d like to know how can I change the default locale via command line without restarting the system – which is not possible in a Docker build :). I managed to do it in Debian by changing setting LANG,LANGUAGE and LC_* […]

Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.