Docker Volumes Explained (PostgreSQL example)

Поделиться
HTML-код
  • Опубликовано: 22 янв 2025

Комментарии • 66

  • @matthewwiese6972
    @matthewwiese6972 4 года назад +46

    This is a wonderful video! You inspire me to keep pushing!
    A clever mnemonic (not my own) for remembering tar:
    czvf = create ze vucking file
    xzvf = xtract ze vucking file

    • @hnasr
      @hnasr  4 года назад +3

      Matthew Wiese LOL I LOVED IT!!! I am going to start using it!

  • @sany2k8
    @sany2k8 4 года назад +6

    Whenever you start showing hands-on demo, you became a legend to me, you are genius on explaining things but hands-on demo make you super special. Keep up your good work.

  • @aubydauby
    @aubydauby Год назад

    Let me tell you- when I looked this topic up and saw you had a video in the search results, I felt instant relief. Dare I say, excited

  • @salmanmusa9930
    @salmanmusa9930 2 года назад

    when ever I am looking for something and I see your video am excited that I have found what I am looking for

  • @mattbillman4688
    @mattbillman4688 3 года назад

    This guy's a natural teacher - thank you for the content! Made my life much easier.

  • @MrOmarlive11
    @MrOmarlive11 4 года назад

    Thank you Hussein for your explanation, I tended to use docker volume for the exact same case you mentioned in 12:10

  • @joaquinurruti2628
    @joaquinurruti2628 9 месяцев назад

    Exactly what I was looking for and perfectly explained, thanks a lot!

  • @IBITZEE
    @IBITZEE 3 года назад

    dude... when I'm searching for some topic video and I see one of yours... ;-)
    I already like it first and then proceed to see the video... LOL!!!

  • @islamsaied6484
    @islamsaied6484 2 года назад

    thanks Hussein, its so simple and clear .

  • @juansalcedo6428
    @juansalcedo6428 2 года назад

    That's exactly what I was looking for, Thanks a lot.

  • @okonkwo.ify18
    @okonkwo.ify18 2 года назад

    This guy is funny. No dull moment with him lol

  • @najisolayman
    @najisolayman 3 года назад +1

    Hussein god bless u with this information

  • @yousefpahang
    @yousefpahang 2 года назад

    Keep on Hussein this is perfect !

  • @Ma1efcent
    @Ma1efcent 2 года назад

    Very well explained, & clear communication, - so many tech videos are created by people who are very difficult to understand. Thank you! :) ATB

  • @osazemeusen1091
    @osazemeusen1091 5 лет назад +1

    Sweet, Succinct and straight to the point

    • @hnasr
      @hnasr  5 лет назад

      Thanks 😊 docker is awesome. enjoy the content.

  • @patriciokumagae6167
    @patriciokumagae6167 2 года назад

    Super clear man! Thank you!

  • @AbdullahKhan-hz7yr
    @AbdullahKhan-hz7yr 3 года назад

    Another fantastic informative vid... quick question, or better still a follow up vid request... how to extend this to concept to my NAS drive, i.e. NFS storage?

  • @OtRatsaphong
    @OtRatsaphong 4 года назад +1

    Great video!! Thank you 😊

    • @hnasr
      @hnasr  4 года назад

      Thanks for watching and for all your comments!!

  • @dudulofuu
    @dudulofuu 3 года назад

    Well done bro!

  • @ammadkhan4687
    @ammadkhan4687 9 месяцев назад

    Hi Hussein, you are better than uni professor. Thanks for the video. I am wondering if it is possible to attach this volume of data to more than one postgres container for load balancing?

  • @MainakKundu19
    @MainakKundu19 4 года назад +1

    Very useful video

  • @LawZist
    @LawZist 5 лет назад +1

    Great video!

    • @hnasr
      @hnasr  5 лет назад

      Thanks for your support in all the videos I make 😊 One of the OG subs

  • @Ali_Alhajji
    @Ali_Alhajji 4 года назад +23

    how to remember tar flags:
    tar -xzf eXtract Ze Files.
    tar -czf Compress Ze Files.

  • @dorota7356
    @dorota7356 3 года назад

    For me, the data is correctly restored even after running 'docker -rm , but the backup files are not visible on the host or in the container. Anyone has an idea why?

  • @mohameddiaa3037
    @mohameddiaa3037 2 года назад

    Thanks hussein

  • @karapelerin61
    @karapelerin61 3 года назад

    Hi Hussein, Thanks for this video. If created a postgresql 9.5 container and add a volume /pg to it, and several days later created a new container for postgresql 10 and used same data volume /pg folder. Is there any problem for this operation?

  • @DerekHuggens
    @DerekHuggens 2 года назад

    Hello Hussein, (I am on Windows) I have a Docker container setup with the newest PostgreSQL image and used the docker run command in this video. In Docker I can see the container is running and with docker ps I can see the container. Docker inspect on the Container ID shows everything looks great. However, in PgAdmin4 when I create a server: General Tab, server name: pg, Connection Tab: Port 5432, Maintenance Database is postgres, Username is postgres, Password is postgres, I cannot create the server because no "Host name/address" ever works! Yours is Husseinmac, but I do not know what mine is to get this working! Please advise, Thank You.

  • @НаильГилазиев
    @НаильГилазиев 4 года назад +1

    Great video! can you research more advanced topic? best way to work with postgres data migrations. When you have postgres db in one container and backend app on other container. Backend app on java (ktor or vertx or other lightweight backend framework even in pure netty)
    1) What the best way to initialize initial database structure with all required extensions(ex timescaledb)
    2) What the best way to migrate database data structure while your project evolving
    Thanks!

  • @fahemzoldyck1729
    @fahemzoldyck1729 4 года назад

    is it possible to use two named volumes in the same Postgres Container ?

  • @ephraiminsular6496
    @ephraiminsular6496 3 года назад

    Can you track with git the files in the docker volumes? Will that be a good idea?

  • @ibrahimalshmrani8216
    @ibrahimalshmrani8216 4 года назад

    how do make 2 postgres containers have shared volumes so any changes on one it will affect the other ?

    • @hnasr
      @hnasr  4 года назад

      you can't, this is a bad idea. there might be a way to run postgres as read only even then the way the database locks files on disk . You can run one at a time but not two at the same time.

  • @RodrigoQueiroz-z9y
    @RodrigoQueiroz-z9y 7 месяцев назад

    The problem is when my volume dont have the rights permissions. Aways it come with only root permissions to write and read

  • @mohamedyoussef8835
    @mohamedyoussef8835 Год назад

    Awesome video +++++++++++++++ 🙂

  • @tsiroukismichael9606
    @tsiroukismichael9606 3 года назад

    Hi Hussein. Congratulations for your great tutorials !!! After deciding to transfer my postgres with the persistant data from my Windows machine to a Linux machine (ubuntu 20.04) , i faced the following problem. I tranfered the tar file to the linux machine and untared it but without any luck. While trying to start running the postgres image with the persistant volume attached , the following error appears on the terminal .
    LOG: unrecognized configuration parameter "max_wal_size" in file "/var/lib/postgresql/data/postgresql.conf" line 228
    LOG: unrecognized configuration parameter "min_wal_size" in file "/var/lib/postgresql/data/postgresql.conf" line 229
    FATAL: configuration file "/var/lib/postgresql/data/postgresql.conf" contains errors
    Also i tried with the unziped folder to check if there was any error on the compression/decompression of the folders. Also In this case i get the same error message?
    Is there any workaround on this ? Has anyone faced the same problem ?

  • @soaring_dove
    @soaring_dove 4 года назад +1

    Awesome dude, but why not use docker-compose so as not to re-type lengthy commands ?

    • @hnasr
      @hnasr  4 года назад +2

      AudacityTunesE.T.C its a great idea for sure. I usually use technology that ai have explained in the channel. Since I still didn’t talk about compose I decided to go the simple route to explain things.
      Need to make the compose video that is a great idea! Thanks!

    • @soaring_dove
      @soaring_dove 4 года назад

      @@hnasr it's alright, I understand 👌

    • @86Saurabh1
      @86Saurabh1 4 года назад

      Any idea when you plan to make a video on docker-compose ?

  • @MostafaZeinali
    @MostafaZeinali 3 года назад

    Great vid. Thanks. One question guys, on a linux server, what is a good place/path to map as the data folder? Should it be in the $user folder, or some path from / I'm asking this because I'm assuming changing the user's name should not affect how the container works, right?

    • @MostafaZeinali
      @MostafaZeinali 3 года назад

      Just off the top of my head, since PostgreSQL stores its data in /var/lib/postgresql/data, why not user /var/lib/postgresql/data/$container_name$ or something like that

    • @MostafaZeinali
      @MostafaZeinali 3 года назад

      The permissions might be the most important issue here...

  • @sergiimarchuk6405
    @sergiimarchuk6405 2 года назад

    Thank you

  • @RuslanSkiraUkraine
    @RuslanSkiraUkraine 4 года назад

    Could you please show the same with the docker container. I'm trying3 times and my db is empty without structure.

  • @ricardohincapie1537
    @ricardohincapie1537 4 года назад

    Thanks!!!

  • @russellbateman3392
    @russellbateman3392 2 года назад +1

    Good tutorial, but the PostgreSQL Docker container has changed, so you cannot easily follow along any more. You have to do stuff like add "--env POSTGRES_PASSWORD=password" to his command lines.

  • @rahul_bali
    @rahul_bali 4 года назад +2

    Error: Database is uninitialized and superuser password is not specified.
    You must specify POSTGRES_PASSWORD to a non-empty value for the
    superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
    You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
    connections without a password. This is *not* recommended.
    See PostgreSQL documentation about "trust":
    www.postgresql.org/docs/current/auth-trust.html

  • @BhargavMurari
    @BhargavMurari 4 года назад

    This doesn't work on Windows machine docker till date for postgres.

    • @hnasr
      @hnasr  4 года назад

      Can you make sure you enabled linux container on docker for windows?

    • @BhargavMurari
      @BhargavMurari 4 года назад

      @@hnasr yeah, it is enabled. The error details are here. There is no direct volume mapping we can do in windows for postgres till date. forums.docker.com/t/data-directory-var-lib-postgresql-data-pgdata-has-wrong-ownership/17963

    • @BhargavMurari
      @BhargavMurari 4 года назад

      I mean volume mapping to my C:/postgrrs/data like that

    • @abhisheksahu616
      @abhisheksahu616 4 года назад

      @@BhargavMurari Works for me. I have enabled linux container on docker as well. docker run --name pg -p 5432:5432 -e POSTGRES_PASSWORD=postgres -v C:\Users\*******\Documents\postgres_v:/var/lib/postgresql/data postgres:10

    • @BhargavMurari
      @BhargavMurari 4 года назад

      @@abhisheksahu616 using WSL2?

  • @zickonezero
    @zickonezero 2 года назад

    👏🏻

  • @HungNguyen-lz5xb
    @HungNguyen-lz5xb 3 года назад

    this guy wrote tar with correct syntax in one try without googling....

  • @YousufZiaTheOneAndOnly
    @YousufZiaTheOneAndOnly 4 года назад

    If you guys are interested in a node ts and postgres setup with docker you can checkout this blog: yzia2000.github.io/blog/2021/01/15/docker-postgres-node.html