However, if I first launch WSL (wsl) and then run the same command inside the WSL environment, everything works fine.
Is this the intended behavior?
Originally created by @ademirtug on GitHub (Feb 13, 2025).
I'm encountering the error "GTK initialization failed" when running the following command from the Windows Terminal:
`docker run -it --device /dev/kvm -p 50921:10022 -v /mnt/wslg/.X11-unix:/tmp/.X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" -e RAM=8 -e EXTRA='-smp 8,sockets=4,cores=2' -e GENERATE_UNIQUE=true -e CPU='Haswell-noTSX' -e CPUID_FLAGS='kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on' -e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom-sonoma.plist' -e SHORTNAME=sonoma sickcodes/docker-osx:latest`
However, if I first launch WSL (wsl) and then run the same command inside the WSL environment, everything works fine.
Is this the intended behavior?
Experienced the same for SHORTNAME=ventura and SHORTNAME=sonoma.
Ran xhost + and it worked.
Relevant log lines:
Authorization required, but no authorization protocol specified gtk initialization failed
@ipaqmaster commented on GitHub (Feb 22, 2025):
Experienced the same for `SHORTNAME=ventura` and `SHORTNAME=sonoma`.
Ran `xhost +` and it worked.
Relevant log lines:
`Authorization required, but no authorization protocol specified`
`gtk initialization failed`
أن Docker Desktop مهيأ لاستخدام WSL2 (إعدادات Docker → General → Use WSL 2 based engine).
ملاحظة: إذا استمرت المشكلة، جرب إضافة --network host إلى الأمر لتجنب مشاكل شبكة Docker.
@mohamadsy1234 commented on GitHub (Apr 9, 2025):
لحل مشكلة "فشل تهيئة GTK" عند تشغيل الأمر في Windows Terminal، اتبع الخطوات التالية:
### 1. تثبيت خادم X11 على Windows:
- **تنزيل وتثبيت VcXsrv** من [هنا](https://sourceforge.net/projects/vcxsrv/).
- عند التشغيل، اختر "Disable access control" في إعدادات الأمان لتسماح للحاوية بالاتصال.
### 2. تعديل متغير `DISPLAY` في الأمر:
- استخدم عنوان `host.docker.internal` للاتصال بخادم X على الـ host:
```bash
-e "DISPLAY=host.docker.internal:0.0"
```
### 3. إزالة مشاركة مجلد WSLg:
- احذف الجزء التالي من الأمر، لأنه يعتمد على WSLg غير المتوفر خارج WSL:
```bash
-v /mnt/wslg/.X11-unix:/tmp/.X11-unix
```
### 4. الأمر المعدل النهائي:
```bash
docker run -it --device /dev/kvm -p 50921:10022 \
-e "DISPLAY=host.docker.internal:0.0" \
-e RAM=8 \
-e EXTRA='-smp 8,sockets=4,cores=2' \
-e GENERATE_UNIQUE=true \
-e CPU='Haswell-noTSX' \
-e CPUID_FLAGS='kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on' \
-e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom-sonoma.plist' \
-e SHORTNAME=sonoma \
sickcodes/docker-osx:latest
```
### 5. تأكد من:
- تشغيل VcXsrv قبل تنفيذ الأمر.
- فتح الجدار الناري لـ VcXsrv إذا لزم الأمر.
- أن Docker Desktop مهيأ لاستخدام WSL2 (إعدادات Docker → General → Use WSL 2 based engine).
---
**ملاحظة:** إذا استمرت المشكلة، جرب إضافة `--network host` إلى الأمر لتجنب مشاكل شبكة Docker.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @ademirtug on GitHub (Feb 13, 2025).
I'm encountering the error "GTK initialization failed" when running the following command from the Windows Terminal:
docker run -it --device /dev/kvm -p 50921:10022 -v /mnt/wslg/.X11-unix:/tmp/.X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" -e RAM=8 -e EXTRA='-smp 8,sockets=4,cores=2' -e GENERATE_UNIQUE=true -e CPU='Haswell-noTSX' -e CPUID_FLAGS='kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on' -e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom-sonoma.plist' -e SHORTNAME=sonoma sickcodes/docker-osx:latestHowever, if I first launch WSL (wsl) and then run the same command inside the WSL environment, everything works fine.
Is this the intended behavior?
@ipaqmaster commented on GitHub (Feb 22, 2025):
Experienced the same for
SHORTNAME=venturaandSHORTNAME=sonoma.Ran
xhost +and it worked.Relevant log lines:
Authorization required, but no authorization protocol specifiedgtk initialization failed@mohamadsy1234 commented on GitHub (Apr 9, 2025):
لحل مشكلة "فشل تهيئة GTK" عند تشغيل الأمر في Windows Terminal، اتبع الخطوات التالية:
1. تثبيت خادم X11 على Windows:
2. تعديل متغير
DISPLAYفي الأمر:host.docker.internalللاتصال بخادم X على الـ host:3. إزالة مشاركة مجلد WSLg:
4. الأمر المعدل النهائي:
5. تأكد من:
ملاحظة: إذا استمرت المشكلة، جرب إضافة
--network hostإلى الأمر لتجنب مشاكل شبكة Docker.