How to add a disk to Docker on OpenWrt?

To add a disk to Docker, you can follow these steps:

  1. Ensure that Docker has been installed on your OpenWrt device. If it has not been installed, please refer to the official OpenWrt documentation for installation instructions.
  2. Connect to the OpenWrt device terminal and create a directory to mount the disk using the following command.
  3. Create a new directory called “docker” in the “/mnt” directory.
  4. Mount the disk to the newly created directory using the following command:
  5. Mount the device /dev/sdX to the directory /mnt/docker.
  6. Replace /dev/sdX with the pathway of the disk device you want to mount.
  7. Edit the /etc/fstab file using the following command to automatically mount the disk during system startup.
  8. Edit the file /etc/fstab.
  9. Add the following lines to the document:
  10. Mount the ext4 filesystem located at /dev/sdX to /mnt/docker with default settings.
  11. Replace /dev/sdX with the path of the disk device you want to mount.
  12. Save and close the /etc/fstab file.
  13. Reload the /etc/fstab file to apply the changes.
  14. mount all drives
  15. Confirm that the disk has been successfully mounted to the /mnt/docker directory.
  16. Display file system disk space usage.
  17. Now, you can utilize the /mnt/docker directory in Docker to store container data and files.

Please note that the /dev/sdX in the above steps is an example disk device path. You need to replace it with your actual disk device path. Additionally, these steps are based on the OpenWrt system and may vary slightly for other Linux distributions.

bannerAds