- bash
- apt update
- apt upgrade
- apt install ca-certificates
- apt install vim
否则不方便搞事情
https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
- unminimize
参考资料:https://www.makeuseof.com/install-desktop-environment-gui-ubuntu-server/
- apt install ubuntu-desktop
docker run -d --name wechat --ipc=host -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY
docker run -it --env="DISPLAY=host.docker.internal:0" -v /tmp/.X11-unix:/tmp/.X11-unix:rw bestwu/wechat
docker run -it --env="DISPLAY=host.docker.internal:0" bestwu/wechat
docker run -it --env="DISPLAY=host.docker.internal:0" bestwu/qq:latest
docker run -it --env="DISPLAY=host.docker.internal:0" jess/firefox
docker run -it --device /dev/kvm -p 50922:10022 -v /tmp/.X11-unix:/tmp/.X11-unix -e "DISPLAY=host.docker.internal:0" sickcodes/docker-osx:latest
sudo docker run --rm -it --shm-size=512m -p 6901:6901 -e VNC_PW=password kasmweb/desktop
docker run -it --env="DISPLAY=host.docker.internal:0" centminmod/docker-ubuntu-vnc-desktop
参考资料:http://mamykin.com/posts/running-x-apps-on-mac-with-docker/
其实这种方式不好,也不安全,但是简单
export DISPLAY=host.docker.internal:0
add-apt-repository ppa:flatpak/stable apt update apt install flatpak
apt install gnome-software-plugin-flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
https://flathub.org/apps/details/com.usebottles.bottles
add-apt-repository ppa:mozillateam/ppa
apt-get install software-properties-common
How can I launch gnome-terminal remotely on my headless server? (fails to launch over X11 forwarding)
docker run -it --rm --env="DISPLAY=host.docker.internal:0" quizzical_feistel xeyes docker run -it --env="DISPLAY=host.docker.internal:0" -v /tmp/.X11-unix:/tmp/.X11-unix:rw 6f57225a5494b11b67208be594c9a35333399087121f91bb263cbb532ada824f gnome-calculator
6f57225a5494
docker ps -a
docker commit -m "ubuntu desktop" -a "lemonhall" 6f57225a5494 lemonhall/ubuntu_desktop
docker run -it --rm --env="DISPLAY=host.docker.internal:0" -v /tmp/.X11-unix:/tmp/.X11-unix lemonhall/ubuntu_desktop Xsession
这就是可以的
docker run -it --rm --env="DISPLAY=host.docker.internal:0" -v /tmp/.X11-unix:/tmp/.X11-unix lemonhall/ubuntu_desktop gnome-calculator
docker run -it --rm --env="DISPLAY=host.docker.internal:0" -v /tmp/.X11-unix:/tmp/.X11-unix lemonhall/ubuntu_desktop bash
root@c03f7c87135b:/etc/gdm3# cat custom.conf
# GDM configuration storage
#
# See /usr/share/gdm/gdm.schemas for a list of available options.
[daemon]
# Uncomment the line below to force the login screen to use Xorg
WaylandEnable=false
# Enabling automatic login
AutomaticLoginEnable = true
AutomaticLogin = root
# Enabling timed login
# TimedLoginEnable = true
# TimedLogin = user1
# TimedLoginDelay = 10
[security]
DisallowTCP=false
[xdmcp]
Enable = true
[chooser]
[debug]
# Uncomment the line below to turn on debugging
# More verbose logs
# Additionally lets the X server dump core if it crashes
#Enable=true
dbus-launch export $(dbus-launch)
https://gist.github.com/BoQsc/d2191f4711cdc55a1c3787ffc06c3240
mkdir -p /run/dbus service dbus start dbus-daemon --system
启动dbus
export XDG_SESSION_TYPE=x11 export GDK_BACKEND=x11 gnome-session
这样会报错
输出两个系统变量
startx /usr/bin/gnome-session
17 mkdir -p /run/dbus 18 service dbus start 19 dbus-launch 20 export $(dbus-launch) 21 dbus-daemon --system 22 export XDG_SESSION_TYPE=x11 23 export GDK_BACKEND=x11
docker run -it --rm --env="DISPLAY=host.docker.internal:0" -v /tmp/.X11-unix:/tmp/.X11-unix lemonhall/ubuntu_desktop bash
bwrap: Creating new namespace failed: Operation not permitted error: ldconfig failed, exit status 256
--privileged
docker run -it --rm --privileged --env="DISPLAY=host.docker.internal:0" -v /tmp/.X11-unix:/tmp/.X11-unix lemonhall/ubuntu_desktop bash
flatpak override com.usebottles.bottles --filesystem=/root/ flatpak override com.usebottles.bottles --nofilesystem=/root/