piątek, 30 września 2016

Run PostgreSQL using Docker with persistent data on Windows 10

Hello :-),

Recently I try too learn docker and how to use it, because I want to use it on my team.

For start I only need this as development environment on developers local machine. The task was simple, for now I just need start PostgreSQL and Redis, there are plenty information on the Internet how to start those containers and how to prepare docker-compose to start those two services, but there was ONE BIG PROBLEM I want my database data to be persistent so after we setup database and insert data and machine restarts or shutdown data will not be lost.

Well, the problem began..

I was not able to find one clear way of doing this on Windows.. I use docker version 1.12 for Windows.



 So I created this docker-compose.yml file after some articles. I try to persist data on the host machine...

So I start it with docker-compose up and both services: postgres and redis started and I was able to access it and create database with data, I was so happy when I run command docker-compose down and once again docker-compose up and saw that my database still exists without recreating!! Yes!!

I was little suprised that folder on my host C:\Users\Łukasz\dbdata which I put in docker-compose file was epty, I thougt that there should be some postgresql files in it...

But it works so propably my task was over..... not so fast, I need to restart my Windows, and after this I was suprised after launch docker-compose up.. my database with data was gone :-(.

Ok So I will try to read how to mount folder from host machine to docker containr in Windows. so I ended with this error data directory "/var/lib/postgresql/data" has wrong ownership and for now I gave up trying to mount volume on host machine.

So I go with this steps when I try to mount volume on host machine on Windows:

1. I share my C: and D: drive in docker settings


2. As a credential I put username with computer name RISCOLAP\Łukasz or using ip address like this: 10.0.75.1\Łukasz, when we put just username we are not enable to list shared folders.

3. Next I create folder data on my C: drive and put file on this
4. After this when I run command docker run --rm -v c:/Users:/data alpine ls /data I saw my file


5. I try to start postgres container with my host volume: At start everything was looking really good. Folder on my host was filled with postgresql files!!
And then I saw this error on console :-(, and my joy was over.

waiting for server to start....FATAL: data directory "/var/lib/postgresql/data" has wrong ownership HINT: The server must be started by the user that owns the data directory.

For now I do not find answer how to deal with this error. So for now I stop trying mount host folder as volume.

And I found working solution with docker volume without host volumes. So first we need to create volume with and then using this volume I create my docker-compose file like this:
And it works!! I can now restart my machine, shut down, and my data are safe!!! If you want more technical info I put some links I was reading during my searching of the solution:

10 komentarzy:

  1. One word of caution... if that setup doesn't respect fsync calls issued by Postgres then you're likely to end up with corruption if the image (or the host) crashes. So don't store anything critical in it. :)

    OdpowiedzUsuń
    Odpowiedzi
    1. Hi, Thank you for your comment. Like you suggest this setup is not for critical data and this why I only think to use this setup on development environment or testing but not on production.

      Usuń
    2. Potrzebujesz zatrudnić hakera❓ Następnie skontaktuj się z PYTHONAX✅

      Naprawdę niesamowita okazja do skontaktowania się z PYTHONAX polega na tym, że dokonany przez nas Hack nie może zostać namierzony, ponieważ każde nasze zadanie hakowania jest silnie chronione przez naszą zaporę ogniową. To tak, jakby powiedzieć, że jeśli ktoś spróbuje wyśledzić Hack, doprowadzi go do nas i zablokujemy wszystkie jego działania.

        Jesteśmy prawie niewidoczni dla władz od prawie dekady, a jeśli przejdziesz do Google PYTHONAX, tak naprawdę nie o nas wyjdzie, możesz zobaczyć tylko komentarze zrobione przez nas lub o nas.

        Kolejną niesamowitą rzeczą, z której możesz skorzystać przy zatrudnianiu naszych hakerów, jest to, że otrzymujesz Legit i najlepszą usługę hakowania, ponieważ zapewniamy Ci profesjonalnych hakerów, którzy mają specjalizacje w obszarze hakowania.
         Wykonujemy każdego hacka, używając specjalnych narzędzi hakerskich, które otrzymujemy z ciemnej sieci.

         Niektóre z oferowanych przez nas usług hakerskich to:
      ▪️ Hakowanie i klonowanie telefonów ✅
      ▪️Hakowanie komputera ✅
      ▪️ Hakowanie kont e-mail i mediów społecznościowych✅
      ▪️ Odzyskiwanie usuniętych plików✅
      ▪️ Śledzenie i znajdowanie osób ✅
      ▪️Unikanie oszustów✅
      ▪️ Wykrywanie włamań ✅
      ▪️Stealing / Kopiowanie plików i dokumentów z ograniczonych sieci i serwerów ✅
      ▪️Mnożenie Bitcoinów✅
      ▪️ Odzyskiwanie pieniędzy z opcji binarnej ✅
      ▪️ Odzyskiwanie pieniędzy na rynku Forex✅
      ▪️ Odzyskiwanie pieniędzy opcji IQQ
      I wiele więcej......


      Niezależnie od tego, jakiej usługi hakerskiej potrzebujesz, po prostu prześlij nam e-mail na adres e-mail podany poniżej.
      pythonaxhacks@gmail.com
      pythonaxservices@gmail.com

        PYTHONAX.
      2020 © Wszelkie prawa zastrzeżone.

      Usuń
    3. Selling good and fresh cvv fullz

      track 1 and 2 with pin

      bank login

      bank transfer

      writing cheques

      transfer to cc ...

      Sell Fresh CVV - Western Union Transfer - Bank Login - Card Dumps - Paypal - Ship

      Fresh Cards, Selling Dumps, Cvvs, Fullz

      Tickets,Hotels,Credit card topup...Paypal transfer, Mailer,Smtp,western union login,

      Book Flight Online

      SELL CVV GOOD And HACK BIG CVV GOOD Credit Card

      Fresh Cards. Selling Dumps, Cvvs, Fullz.Tickets,Hotels,Credit cards


      Sell Cvv(cc) - Wu Transfer - Card Dumps - Bank login/paypal

      And many more other hacking services

      contact me : hackerw169@gmail.com
      ICQ: 699 396 818


      - I have account paypal with good balance

      - I hope u good customers and will be long-term cooperation


      Prices Western Union Online Transfer


      -Transfer(Eu,Uk,Asia,Canada,Us,France,Germany,Italy and very

      easy to do African)

      - 200$ = 1500$ (MTCN and sender name + country sender)

      - 350$ = 4000$ (MTCN and sender name + country sender)

      - 500$ = 6000$ (MTCN and sender name + country sender)

      - 600$ = 8000$ (MTCN and sender name + country sender)

      Then i will do transfer's for you, After about 30 mins you'll have

      MTCN and sender name + country sender


      - Dumps prices

      - Tracks 1&2 US = 85$ per 1

      - Tracks 1&2 UK = 100$ per 1

      - Tracks 1&2 CA / AU = 110$ per 1

      - Tracks 1&2 EU = 120$ per 1


      Bank Logins Prices US UK CA AU EU


      - Bank Us : ( HALIFAX,BOA,CHASE,Wells Fargo...)

      . Balance 5000$ = 250$

      . Balance 8000$ = 400$

      . Balance 12000$ = 600$

      . Balance 15000$ = 800$

      . Balance 20000$ = 1000$

      - Bank UK : ( LLOYDS TSB,BARCLAYS,Standard Chartered,HSBC...)

      . Balance 5000 GBP = 300 GBP

      . Balance 12000 GBP = 600 GBP

      . Balance 16000 GBP = 700 GBP

      . Balance 20000 GBP = 1000 GBP

      . Balance 30000 GBP = 1200 GBP


      contact me : hackerw169@gmail.com
      ICQ: 699 396 818

      Usuń
  2. Thanks man! I was on point to give up docker because of this same error, you save the day haha

    OdpowiedzUsuń
  3. It feels like a very important thing is missing here. How to get access to the actual files in this approach?

    OdpowiedzUsuń
  4. So docker Postgresql shouldn't be used on Windows? How to tell if fsync is respected?

    OdpowiedzUsuń
  5. i was lost with no hope for my wife was cheating and had always got away with it because i did not know how or always too scared to pin anything on her. with the help a friend IN PERSON OFJOHN who recommended me to who help hack her phone, email, chat, sms and expose her for a cheater she is. I just want to say a big thank you to HACKINTECHNOLOGY@GMAIL.COM . am sure someone out there is looking for how to solve his relationship problems, you can also contact him for all sorts of hacking job..he is fast and reliable. you could also text +1 669 225 2253

    OdpowiedzUsuń
  6. Selling good and fresh cvv fullz

    track 1 and 2 with pin

    bank login

    bank transfer

    writing cheques

    transfer to cc ...

    Sell Fresh CVV - Western Union Transfer - Bank Login - Card Dumps - Paypal - Ship

    Fresh Cards, Selling Dumps, Cvvs, Fullz

    Tickets,Hotels,Credit card topup...Paypal transfer, Mailer,Smtp,western union login,

    Book Flight Online

    SELL CVV GOOD And HACK BIG CVV GOOD Credit Card

    Fresh Cards. Selling Dumps, Cvvs, Fullz.Tickets,Hotels,Credit cards


    Sell Cvv(cc) - Wu Transfer - Card Dumps - Bank login/paypal

    And many more other hacking services

    contact me : hackerw169@gmail.com
    ICQ: 699 396 818


    - I have account paypal with good balance

    - I hope u good customers and will be long-term cooperation


    Prices Western Union Online Transfer


    -Transfer(Eu,Uk,Asia,Canada,Us,France,Germany,Italy and very

    easy to do African)

    - 200$ = 1500$ (MTCN and sender name + country sender)

    - 350$ = 4000$ (MTCN and sender name + country sender)

    - 500$ = 6000$ (MTCN and sender name + country sender)

    - 600$ = 8000$ (MTCN and sender name + country sender)

    Then i will do transfer's for you, After about 30 mins you'll have

    MTCN and sender name + country sender


    - Dumps prices

    - Tracks 1&2 US = 85$ per 1

    - Tracks 1&2 UK = 100$ per 1

    - Tracks 1&2 CA / AU = 110$ per 1

    - Tracks 1&2 EU = 120$ per 1


    Bank Logins Prices US UK CA AU EU


    - Bank Us : ( HALIFAX,BOA,CHASE,Wells Fargo...)

    . Balance 5000$ = 250$

    . Balance 8000$ = 400$

    . Balance 12000$ = 600$

    . Balance 15000$ = 800$

    . Balance 20000$ = 1000$

    - Bank UK : ( LLOYDS TSB,BARCLAYS,Standard Chartered,HSBC...)

    . Balance 5000 GBP = 300 GBP

    . Balance 12000 GBP = 600 GBP

    . Balance 16000 GBP = 700 GBP

    . Balance 20000 GBP = 1000 GBP

    . Balance 30000 GBP = 1200 GBP


    contact me : hackerw169@gmail.com
    ICQ: 699 396 818

    OdpowiedzUsuń