Docker Volumes Explained (PostgreSQL example)

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ธ.ค. 2024

ความคิดเห็น •

  • @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.

  • @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!

  • @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.

  • @Ali_Alhajji
    @Ali_Alhajji 4 ปีที่แล้ว +23

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

  • @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

  • @najisolayman
    @najisolayman 3 ปีที่แล้ว +1

    Hussein god bless u with this information

  • @joaquinurruti2628
    @joaquinurruti2628 8 หลายเดือนก่อน

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

  • @islamsaied6484
    @islamsaied6484 2 ปีที่แล้ว

    thanks Hussein, its so simple and clear .

  • @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!!!

  • @okonkwo.ify18
    @okonkwo.ify18 2 ปีที่แล้ว

    This guy is funny. No dull moment with him lol

  • @yousefpahang
    @yousefpahang 2 ปีที่แล้ว

    Keep on Hussein this is perfect !

  • @juansalcedo6428
    @juansalcedo6428 2 ปีที่แล้ว

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

  • @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 4 ปีที่แล้ว +1

    Sweet, Succinct and straight to the point

    • @hnasr
      @hnasr  4 ปีที่แล้ว

      Thanks 😊 docker is awesome. enjoy the content.

  • @patriciokumagae6167
    @patriciokumagae6167 2 ปีที่แล้ว

    Super clear man! Thank you!

  • @mohameddiaa3037
    @mohameddiaa3037 2 ปีที่แล้ว

    Thanks hussein

  • @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?

  • @dudulofuu
    @dudulofuu 3 ปีที่แล้ว

    Well done bro!

  • @OtRatsaphong
    @OtRatsaphong 4 ปีที่แล้ว +1

    Great video!! Thank you 😊

    • @hnasr
      @hnasr  4 ปีที่แล้ว

      Thanks for watching and for all your comments!!

  • @MainakKundu19
    @MainakKundu19 4 ปีที่แล้ว +1

    Very useful video

  • @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

  • @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?

  • @ammadkhan4687
    @ammadkhan4687 8 หลายเดือนก่อน

    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?

  • @LawZist
    @LawZist 4 ปีที่แล้ว +1

    Great video!

    • @hnasr
      @hnasr  4 ปีที่แล้ว

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

  • @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?

  • @НаильГилазиев
    @НаильГилазиев 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!

  • @mohamedyoussef8835
    @mohamedyoussef8835 ปีที่แล้ว

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

  • @sergiimarchuk6405
    @sergiimarchuk6405 2 ปีที่แล้ว

    Thank you

  • @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.

  • @RodrigoQueiroz-z9y
    @RodrigoQueiroz-z9y 6 หลายเดือนก่อน

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

  • @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?

  • @evans8245
    @evans8245 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!

    • @evans8245
      @evans8245 4 ปีที่แล้ว

      @@hnasr it's alright, I understand 👌

    • @86Saurabh1
      @86Saurabh1 4 ปีที่แล้ว

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

  • @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.

  • @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 ?

  • @ricardohincapie1537
    @ricardohincapie1537 4 ปีที่แล้ว

    Thanks!!!

  • @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.

  • @MostafaZeinali
    @MostafaZeinali 2 ปีที่แล้ว

    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 2 ปีที่แล้ว

      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 2 ปีที่แล้ว

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

  • @RuslanSkiraUkraine
    @RuslanSkiraUkraine 4 ปีที่แล้ว

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

  • @zickonezero
    @zickonezero ปีที่แล้ว

    👏🏻

  • @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?

  • @YousufZiaTheOneAndOnly
    @YousufZiaTheOneAndOnly 3 ปีที่แล้ว

    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

  • @HungNguyen-lz5xb
    @HungNguyen-lz5xb 3 ปีที่แล้ว

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