ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Solving Docker Swarm's Volume Persistence Issue with NGINX

Volume on Docker Swarm is not persistent?

linux

docker

nginx

docker swarm

Автор: vlogize

Загружено: 2025-09-29

Просмотров: 3

Описание: Learn how to make your Docker Swarm volumes persistent when running an NGINX service, ensuring your data survives machine reboots.
---
This video is based on the question https://stackoverflow.com/q/63670275/ asked by the user 'Brandon X.' ( https://stackoverflow.com/u/9269659/ ) and on the answer https://stackoverflow.com/a/63679616/ provided by the user 'Mahmoud Roshdy' ( https://stackoverflow.com/u/14199430/ ) at 'Stack Overflow' website. Thanks to these great users and Stackexchange community for their contributions.

Visit these links for original content and any more details, such as alternate solutions, latest updates/developments on topic, comments, revision history etc. For example, the original title of the Question was: Volume on Docker Swarm is not persistent?

Also, Content (except music) licensed under CC BY-SA https://meta.stackexchange.com/help/l...
The original Question post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license, and the original Answer post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license.

If anything seems off to you, please feel free to write me at vlogize [AT] gmail [DOT] com.
---
Understanding the Problem: Volume Persistence on Docker Swarm

If you are using Docker Swarm and have attempted to create a service with NGINX, you may have encountered an issue with data persistence. After making changes to files, you may find that they disappear after stopping and restarting your Docker machine.

In this guide, we will explore how to ensure that your Docker volume remains persistent across restarts, so you can work with Docker Swarm confidently.

The Scenario

You created a service with the following command:

[[See Video to Reveal this Text or Code Snippet]]

Overall, this command should set up an NGINX service running on port 80, storing all website files in a Docker volume at /usr/share/nginx/html. After making changes to index.html, you found that those changes vanished after rebooting the machine with:

[[See Video to Reveal this Text or Code Snippet]]

Why Does This Happen?

The reason your changes were lost is that you created the Docker volume without specifying a source. This means that Docker created an unnamed volume without a defined location to store your data persistently. Consequently, upon reboot, Docker doesn't know how to retrieve the data you've added.

Solution: Create a Named Volume

To solve the persistence issue, you need to create a named volume. Named volumes have defined sources, allowing Docker to manage their data more effectively.

Step-by-Step Instructions

Create a Named Volume: When creating your service, specify the source in the volume mount command. Here's how to do it:

[[See Video to Reveal this Text or Code Snippet]]

In this command:

type=volume indicates that you are using a volume.

source=myvolume is the name you are assigning to your volume.

destination=/usr/share/nginx/html is where the volume is mounted inside the container.

Verify the Service: Once you have created the service with the named volume, you can check if it is running by using your browser to navigate to MANAGER_IP:80.

Make Changes and Test Persistence: You can modify the index.html or any other file inside your service and then stop and start your Docker machine again. After restarting, you should still see your changes intact.

Inspect Your Volume: Use the following command to inspect details about your volume, including its path on the host:

[[See Video to Reveal this Text or Code Snippet]]

Conclusion

By following these steps, you can ensure that your volume remains persistent even after restarting your Docker machine. This fixes the issue of lost data after a reboot in a Docker Swarm environment. Now, you can deploy your NGINX service with confidence, knowing your changes will not disappear unexpectedly.

If you have any further questions or need assistance on this topic, feel free to reach out. Happy Dockering!

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Solving Docker Swarm's Volume Persistence Issue with NGINX

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]