تغيير محرك تخزين Docker

Hello all,

I have been using Docker with the Devicemapper storage driver. After manually editing the launcher script, I finally took the time to convert to Overlay2. Here are the instructions I took to do this. I hope this helps others. I see others have asked the question, but I don’t see any answers. I used this excellent guide to help figure this out.

Step 1: Halt your Discourse application (and other docker apps)

./launcher stop app

Step 2: Commit and save your old Docker containers/images

We first committed each image we care for so that we had the most recent version tagged somewhere with all changes included. This can be done roughly like this:

docker ps -a
# for each container you care for, stop and then commit it
docker commit e198aac7112d export/local_discourse_app 
docker save export/local_discourse_app > export_local_discourse_app.tar.gz

Step 3: Change storage driver

I chose Overlay2, but the Discourse-recommended driver is aufs. Adjust as necessary. If something goes wrong, simply set the storage-driver to devicemapper as needed.

Insert the following into /etc/docker/daemon.json

{
  "storage-driver": "overlay2"
}

Step 4: Restart docker

sudo service docker restart

Step 5: Import image into new storage device

docker load < export_local_discourse_app.tar.gz

Step 6: Rebuild Discourse

./launcher rebuild app

I hope this helps! Feel free to suggest any modifications or questions.

18 إعجابًا

مرحبًا! آسف على الإزعاج، لكنني أستخدم Discourse منذ حوالي عامين، والآن أحاول الدخول في عملية تطوير الإضافات الخاصة به.
لدي خادم VPS مثبت عليه Ubuntu 16.04 حديثًا، ويتم تثبيت Docker افتراضيًا مع devicemapper. لا توجد إمكانية لتغيير ذلك (فالتعليمات المذكورة في هذا الدليل وكل ما تجده على جوجل يجعل من المستحيل تشغيل Docker). هل لديك أي فكرة؟

لماذا أوبونتو 16.04، وهو قديم بالفعل؟ لماذا لا نستخدم 18.04؟

لقد جربت كليهما وأعتقد أن خادم VPS الخاص بي لا يدعم ذلك النواة أو شيء من هذا القبيل. لدي خادم VPS أفضل في نفس الشركة ولا أواجه أي مشكلة…

أفترض أنه بعد ذلك يمكنك (هل يجب عليك؟) حذف الدليل /var/lib/docker/aufs والملف export_local_discourse_app؟