How to Save Docker Data using Bind Mounts or Volumes

  Рет қаралды 32,344

Database Star

Database Star

Күн бұрын

Пікірлер: 52
@thewestindianboy
@thewestindianboy 7 ай бұрын
I saw many videos, but your video finally settled my confusion. Many thanks.
@DatabaseStar
@DatabaseStar 7 ай бұрын
Glad it was helpful!
@joachimhans2944
@joachimhans2944 2 жыл бұрын
Perfect for me. Instead of reading documents I always love to "feel" it with some handson examples. It saved my time. Thanks
@DatabaseStar
@DatabaseStar 2 жыл бұрын
Thanks, glad it was helpful!
@hardworkerbig
@hardworkerbig Жыл бұрын
this is a very great video with a clear and concise explanation of volumes and bind mounts... the best one ever.
@DatabaseStar
@DatabaseStar Жыл бұрын
Glad it was helpful!
@priyanshugupta3160
@priyanshugupta3160 9 ай бұрын
the explanation was so good bro 🔥
@DatabaseStar
@DatabaseStar 9 ай бұрын
Glad you think so!
@bjorn9131
@bjorn9131 Жыл бұрын
every tutorial should be like this. quick and well explained
@DatabaseStar
@DatabaseStar Жыл бұрын
Thanks! Glad to hear it’s a good tutorial.
@manojsinghnegi1565
@manojsinghnegi1565 2 жыл бұрын
perfect. time efficient and informative tutorial. no time wasting. keep it up 👍
@DatabaseStar
@DatabaseStar 2 жыл бұрын
Thanks!
@nishitkumar7650
@nishitkumar7650 2 жыл бұрын
You should post more videos on docker and kubernetes
@DatabaseStar
@DatabaseStar 2 жыл бұрын
Thanks, I have a few more Docker videos planned. Glad you like them!
@jackq9197
@jackq9197 Жыл бұрын
I have been searching a lot about this subject and what you did is the best one
@DatabaseStar
@DatabaseStar Жыл бұрын
Glad to hear it helped!
@anoniem012
@anoniem012 2 жыл бұрын
Thank you man was looking for this, it cleared up confusion, may Allah bless you with Islaam.
@DatabaseStar
@DatabaseStar 2 жыл бұрын
Thanks! Glad you found it helpful.
@suen-tech
@suen-tech 10 ай бұрын
So simple. Thank you.
@DatabaseStar
@DatabaseStar 10 ай бұрын
You're welcome!
@pbanta101
@pbanta101 2 жыл бұрын
Great Video ! ! ! I too was confused by reading different google explanations. This video quickly and clearly explained the concepts. All the examples worked just fine on my machine - a linux machine. Thank You ! ! !
@DatabaseStar
@DatabaseStar 2 жыл бұрын
Thanks! I’m glad it was helpful!
@natural8471
@natural8471 8 ай бұрын
Thank kyou! Great tutorial!!!!
@DatabaseStar
@DatabaseStar 8 ай бұрын
You’re welcome!
@svgenterprises1
@svgenterprises1 11 ай бұрын
Thank you so very much! you really helped me understand how containers use volumes and binds and what is happening setting up my YAML files.
@DatabaseStar
@DatabaseStar 11 ай бұрын
Glad it was helpful!
@maheshyarasi2939
@maheshyarasi2939 29 күн бұрын
Thank you so much for this detailed video. I had one question. When I try to do the bind method my target is "/var/lib/postgresql/data" and I am getting a permission denied error: chmod: changing permissions of '/var/lib/postgresql/data': Operation not permitted It works if I choose any other location including "/var/lib/postgresql" but the data I wish to copy is inside data. Please let me know if you are familiar with this? Thank you again.
@DatabaseStar
@DatabaseStar 26 күн бұрын
Oh that's a bit annoying. I'm not sure what the cause of this is or how to resolve it, unfortunately.
@jeytis72
@jeytis72 Жыл бұрын
very informative and clear, thanks. What if your computer host break completely? Whar are your backup strategies to save elsewhere either a bind mounts or volumes with your data inside?
@DatabaseStar
@DatabaseStar Жыл бұрын
Good question. I’m not sure on the strategies for backups with this approach. I remember reading that docker shouldn’t be used for production databases and this was one reason.
@indylawi5021
@indylawi5021 Жыл бұрын
thank you for your efforts preparing this great and informative video. If I may, I have a question. how about connecting to an existing database server that is on a different machine/host outside of the Docker host? did you come across this use-case in your research. would appreciate your input on this. thx in advance.
@DatabaseStar
@DatabaseStar Жыл бұрын
Glad you like the video! I'm not sure how to do that from within the Docker container, unfortunately. My Docker knowledge is small (but growing) but I'm not sure how to do that.
@redwansikder3847
@redwansikder3847 6 ай бұрын
It removed my confusion about volume and bind mount.
@DatabaseStar
@DatabaseStar 6 ай бұрын
Good to hear!
@dawidgrzeskow987
@dawidgrzeskow987 2 жыл бұрын
Great video Gentelman, sub and like for you, keep up with the good work, happy to be there
@DatabaseStar
@DatabaseStar 2 жыл бұрын
Thanks!
@reallogic0
@reallogic0 2 жыл бұрын
nice tutorial
@DatabaseStar
@DatabaseStar 2 жыл бұрын
Thanks!
@spill1987
@spill1987 2 жыл бұрын
Great video, thanks very much. The --mount type=bind function and how it was working for you in the vid is exactly what I'm looking for but I can't seem to get it working for my windows folder (D:\test). I used --mount type=bind,source=//d/test,target=/opt/drupal so I could see and access what's inside the drupal folder. The command is executed successfully and the container is created, but won't work :( Any ideas on that?
@DatabaseStar
@DatabaseStar 2 жыл бұрын
Glad you liked the video! I'm not sure what would be causing that issue. My first guess would be something to do with the path that is used and how it's on Windows. But you said it executed successfully, so that may not be an issue. Docker offers some logs, which you can use to check for any issues. I don't remember the command for it, but it's on the website, so it may give you more information about your errors.
@spill1987
@spill1987 2 жыл бұрын
@@DatabaseStar Thanks for the hints! As I was doing some research, I found out that mapped volumes can be accessed through \\wsl$\docker-desktop-data\data\docker\volumes. I'm Windows + WSL2 (Ubuntu). So I used that instead of bind mounts. Thanks again for the vid which helped me get there.
@mohamedyoussef8835
@mohamedyoussef8835 Жыл бұрын
Awesome video +++++++++ thank you 🙂
@DatabaseStar
@DatabaseStar Жыл бұрын
Thanks!
@MohaideenA
@MohaideenA Ай бұрын
Getting this error. [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.40-1.el9 started. chown: changing ownership of '/var/lib/mysql/': Permission denied chown: changing ownership of '/var/lib/mysql': Permission denied
@DatabaseStar
@DatabaseStar Ай бұрын
Oh interesting. I’m guessing it’s happening because your current user does not have permission to write to the folder. I’m not sure how to resolve it unfortunately.
@bokkenka
@bokkenka 2 жыл бұрын
How would you copy a volume from a test server to a production server?
@DatabaseStar
@DatabaseStar 2 жыл бұрын
Good question. I'm not sure how, I would usually try to migrate the data and objects rather than the volume. Also, from what I've read, docker volumes aren't advised for production. But I've never done it so I'm not sure.
@rapidscampi
@rapidscampi 2 жыл бұрын
Find the container, identify the tmpfs volume it's using and its host path, then copy the contents into your desired bind mount directory: docker container list |grep mysql copy the container id docker inspect container |grep Source This will show the path of the volume on the host, something like this: /var/lib/docker/volumes/a1126aab5716c00898db30ba50458ab4f32d5b6249416165ef721102f7cc5333/_data navigate to the directory and copy the contents from there into your intended bind mount directory. However, it's worth noting that there's two types of volume mount - named volumes and tmpfs volumes. Ditch the CLI to run containers and use Docker Compose. It makes life a lot easier as you can keep your config. More pertinently you can specify named volumes in your yml file which do persist between restarts. Just create a docker-compose.yml file in an empty directory with the below contents: version: '3.8' services: db: image: mysql:8.0 restart: always environment: - MYSQL_DATABASE=mydb - MYSQL_ROOT_PASSWORD=mauFJcuf5dhRMQrjj ports: - '3306:3306' volumes: - db:/var/lib/mysql #This tells your container to use a named volume called db volumes: #This section defines the volume that's referenced above db: then run "docker-compose up -d" and compose will pull the image, build the containers and create the volume.
@AbdulBasit-ib6by
@AbdulBasit-ib6by 2 жыл бұрын
How to persist data in postgres? I tried using this docker command, docker run --name learn_postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres --mount source=postgres-volume,target=/var/lib/postgresql/data -p 5432:5432 but once I checked container status using docker ps -a I see exited my container just after creation.
@DatabaseStar
@DatabaseStar 2 жыл бұрын
That's a strange one. I remember this happening to me a couple of times while working with Docker. I think there's a way to view some kind of logs in docker so you can see some more information about why it exited. Could you try that? I think there's a docker command for it.
Don't use local Docker Volumes
12:43
Christian Lempa
Рет қаралды 184 М.
Docker Volumes Demo || Docker Tutorial 13
13:08
TechWorld with Nana
Рет қаралды 75 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 16 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 37 МЛН
Подсадим людей на ставки | ЖБ | 3 серия | Сериал 2024
20:00
ПАЦАНСКИЕ ИСТОРИИ
Рет қаралды 502 М.
3 ways to reduce the size of your docker images
17:20
Raghav Dua
Рет қаралды 22 М.
40 Advanced Tips for SSMS (To Save You Time)
29:41
Database Star
Рет қаралды 1,6 М.
How to Set Up Oracle Database with Docker (Official Container Image)
10:56
Microservices with Databases can be challenging...
20:52
Software Developer Diaries
Рет қаралды 108 М.
My Favorite Way To Handle Dev Environments | VS Code Devcontainers
30:05
The intro to Docker I wish I had when I started
18:27
typecraft
Рет қаралды 302 М.
Docker Compose Tutorial
33:02
Programming with Mosh
Рет қаралды 467 М.
What is Docker Volume | How to create  Volumes | What is Bind Mount | Docker Storage
16:51