├── Dockerfile ├── README.md └── i3-config /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | # Expose the SSH port 3 | EXPOSE 22 4 | 5 | RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y openssh-server \ 6 | x11-apps xterm language-pack-en-base \ 7 | xserver-xephyr i3 8 | 9 | # Create OpenSSH privilege separation directory 10 | RUN mkdir /var/run/sshd 11 | 12 | RUN adduser --disabled-password --gecos "User" --uid 1000 user 13 | 14 | # to allow adding the public key e.g. with docker exec -i x11-xpra /bin/bash -c 'cat > /home/user/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub 15 | RUN mkdir /home/user/.ssh/ 16 | 17 | RUN mkdir /home/user/.i3 18 | ADD i3-config /home/user/.i3/config 19 | 20 | VOLUME /home/user 21 | 22 | 23 | RUN echo AddressFamily inet >> /etc/ssh/sshd_config 24 | 25 | 26 | # Start SSH 27 | CMD mkdir -p /home/user/.ssh/ && chown -R user:user /home/user \ 28 | && /usr/sbin/sshd && rm -f /tmp/.X100-lock \ 29 | && su user -c "sleep infinity" 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-x11-xpra 2 | A docker image proving a basis for X applications accessible via ssh ~~with or 3 | without [Xpra](http://xpra.org/) and~~ optionally within Xephyr/i3 4 | 5 | Xpra is currently disabled because of https://github.com/retog/docker-x11-xpra/issues/7 6 | 7 | The docker image comes witha small set o X-Application like xclock, xterm, 8 | xeyes it is meant to be extended to provide the required applications. 9 | 10 | ## Usage example 11 | 12 | Run with 13 | 14 | docker run -p 2020:22 -d --name x11-xpra reto/x11-xpra 15 | 16 | Copy your ssh public key 17 | 18 | docker exec -i x11-xpra /bin/bash -c 'cat > /home/user/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub 19 | 20 | Start xclock 21 | 22 | ssh -p 2020 -X user@localhost xclock 23 | 24 | As any time you can start more applications 25 | 26 | ssh -p 2020 -X user@localhost xeyes 27 | 28 | If rather than having "rootless" remote applications you would like to have a whole 29 | remote desktop you can start start Xephyr as display `:200` 30 | 31 | ssh -p 2020 -X user@localhost "Xephyr -ac -br -noreset -screen 800x600 :200" & 32 | 33 | Start i3 as display manager 34 | 35 | ssh -p 2020 user@localhost DISPLAY=:200 i3 & 36 | 37 | And start xclock on Xephyr 38 | 39 | ssh -p 2020 user@localhost DISPLAY=:200 xclock & 40 | 41 | You may need to adapt the keyboard layout 42 | 43 | ssh -p 2020 user@localhost DISPLAY=:200 setxkbmap -layout ch 44 | 45 | Similar projects 46 | 47 | - A more comprehensive framework to run desktop applications in Docker is [subuser](http://subuser.org/) 48 | 49 | -------------------------------------------------------------------------------- /i3-config: -------------------------------------------------------------------------------- 1 | # i3 config file (v4) 2 | # 3 | # Please see http://i3wm.org/docs/userguide.html for a complete reference! 4 | # 5 | # This config file uses keycodes (bindsym) and was written for the QWERTY 6 | # layout. 7 | # 8 | # To get a config file with the same key positions, but for your current 9 | # layout, use the i3-config-wizard 10 | # 11 | 12 | # Font for window titles. Will also be used by the bar unless a different font 13 | # is used in the bar {} block below. ISO 10646 = Unicode 14 | font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 15 | # The font above is very space-efficient, that is, it looks good, sharp and 16 | # clear in small sizes. However, if you need a lot of unicode glyphs or 17 | # right-to-left text rendering, you should instead use pango for rendering and 18 | # chose a FreeType font, such as: 19 | # font pango:DejaVu Sans Mono 10 20 | set $mod Mod4 21 | 22 | # use Mouse+Mod4 to drag floating windows to their wanted position 23 | floating_modifier Mod4 24 | 25 | # start a terminal 26 | bindsym Mod4+Return exec i3-sensible-terminal 27 | 28 | # kill focused window 29 | bindsym Mod4+Shift+q kill 30 | 31 | # start dmenu (a program launcher) 32 | bindsym Mod4+d exec dmenu_run 33 | # There also is the (new) i3-dmenu-desktop which only displays applications 34 | # shipping a .desktop file. It is a wrapper around dmenu, so you need that 35 | # installed. 36 | # bindsym Mod4+d exec --no-startup-id i3-dmenu-desktop 37 | 38 | # change focus 39 | bindsym Mod4+j focus left 40 | bindsym Mod4+k focus down 41 | bindsym Mod4+l focus up 42 | bindsym Mod4+semicolon focus right 43 | 44 | # alternatively, you can use the cursor keys: 45 | bindsym Mod4+Left focus left 46 | bindsym Mod4+Down focus down 47 | bindsym Mod4+Up focus up 48 | bindsym Mod4+Right focus right 49 | 50 | # move focused window 51 | bindsym Mod4+Shift+j move left 52 | bindsym Mod4+Shift+k move down 53 | bindsym Mod4+Shift+l move up 54 | bindsym Mod4+Shift+semicolon move right 55 | 56 | # alternatively, you can use the cursor keys: 57 | bindsym Mod4+Shift+Left move left 58 | bindsym Mod4+Shift+Down move down 59 | bindsym Mod4+Shift+Up move up 60 | bindsym Mod4+Shift+Right move right 61 | 62 | # split in horizontal orientation 63 | bindsym Mod4+h split h 64 | 65 | # split in vertical orientation 66 | bindsym Mod4+v split v 67 | 68 | # enter fullscreen mode for the focused container 69 | bindsym Mod4+f fullscreen 70 | 71 | # change container layout (stacked, tabbed, toggle split) 72 | bindsym Mod4+s layout stacking 73 | bindsym Mod4+w layout tabbed 74 | bindsym Mod4+e layout toggle split 75 | 76 | # toggle tiling / floating 77 | bindsym Mod4+Shift+space floating toggle 78 | 79 | # change focus between tiling / floating windows 80 | bindsym Mod4+space focus mode_toggle 81 | 82 | # focus the parent container 83 | bindsym Mod4+a focus parent 84 | 85 | # focus the child container 86 | #bindsym Mod4+d focus child 87 | 88 | # switch to workspace 89 | bindsym Mod4+1 workspace 1 90 | bindsym Mod4+2 workspace 2 91 | bindsym Mod4+3 workspace 3 92 | bindsym Mod4+4 workspace 4 93 | bindsym Mod4+5 workspace 5 94 | bindsym Mod4+6 workspace 6 95 | bindsym Mod4+7 workspace 7 96 | bindsym Mod4+8 workspace 8 97 | bindsym Mod4+9 workspace 9 98 | bindsym Mod4+0 workspace 10 99 | 100 | # move focused container to workspace 101 | bindsym Mod4+Shift+1 move container to workspace 1 102 | bindsym Mod4+Shift+2 move container to workspace 2 103 | bindsym Mod4+Shift+3 move container to workspace 3 104 | bindsym Mod4+Shift+4 move container to workspace 4 105 | bindsym Mod4+Shift+5 move container to workspace 5 106 | bindsym Mod4+Shift+6 move container to workspace 6 107 | bindsym Mod4+Shift+7 move container to workspace 7 108 | bindsym Mod4+Shift+8 move container to workspace 8 109 | bindsym Mod4+Shift+9 move container to workspace 9 110 | bindsym Mod4+Shift+0 move container to workspace 10 111 | 112 | #exec --no-startup-id i3-msg 'workspace 1:Web; exec /usr/bin/chromium' 113 | #exec --no-startup-id i3-msg 'workspace 2:Mail; exec /usr/bin/thunderbird' 114 | #exec --no-startup-id i3-msg 'workspace 3:thunar; exec /usr/bin/thunar' 115 | #exec --no-startup-id i3-msg 'workspace 4:URxvt; exec urxvtc &' 116 | #exec --no-startup-id i3-msg 'workspace 5:Thunar; exec /usr/bin/thunar' 117 | 118 | # reload the configuration file 119 | bindsym Mod4+Shift+c reload 120 | # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) 121 | bindsym Mod4+Shift+r restart 122 | # exit i3 (logs you out of your X session) 123 | bindsym Mod4+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" 124 | 125 | # resize window (you can also use the mouse for that) 126 | mode "resize" { 127 | # These bindings trigger as soon as you enter the resize mode 128 | 129 | # Pressing left will shrink the window’s width. 130 | # Pressing right will grow the window’s width. 131 | # Pressing up will shrink the window’s height. 132 | # Pressing down will grow the window’s height. 133 | bindsym j resize shrink width 10 px or 10 ppt 134 | bindsym k resize grow height 10 px or 10 ppt 135 | bindsym l resize shrink height 10 px or 10 ppt 136 | bindsym semicolon resize grow width 10 px or 10 ppt 137 | 138 | # same bindings, but for the arrow keys 139 | bindsym Left resize shrink width 10 px or 10 ppt 140 | bindsym Down resize grow height 10 px or 10 ppt 141 | bindsym Up resize shrink height 10 px or 10 ppt 142 | bindsym Right resize grow width 10 px or 10 ppt 143 | 144 | # back to normal: Enter or Escape 145 | bindsym Return mode "default" 146 | bindsym Escape mode "default" 147 | } 148 | 149 | bindsym Mod4+r mode "resize" 150 | 151 | # Start i3bar to display a workspace bar (plus the system information i3status 152 | # finds out, if available) 153 | 154 | #client.focused #688060 #688060 #303030 #ffcfaf 155 | client.focused #4e6072 #4e6072 #CCCCCC #ffcfaf 156 | 157 | client.focused_inactive #3f3f3f #3F3F3F #7f9f7f #3f3f3f 158 | client.unfocused #3f3f3f #3F3F3F #DCDCCC #3f3f3f 159 | client.urgent #dca3a3 #dca3a3 #DCDCCC #3f3f3f 160 | 161 | 162 | 163 | 164 | set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown 165 | mode "$mode_system" { 166 | bindsym l exec --no-startup-id i3exit lock, mode "default" 167 | bindsym e exec --no-startup-id i3exit logout, mode "default" 168 | bindsym s exec --no-startup-id i3exit suspend, mode "default" 169 | bindsym h exec --no-startup-id i3exit hibernate, mode "default" 170 | bindsym r exec --no-startup-id i3exit reboot, mode "default" 171 | bindsym Shift+s exec --no-startup-id i3exit shutdown, mode "default" 172 | 173 | # back to normal: Enter or Escape 174 | bindsym Return mode "default" 175 | bindsym Escape mode "default" 176 | } 177 | bindsym $mod+Pause mode "$mode_system" 178 | 179 | bindsym XF86AudioRaiseVolume exec amixer -q sset Master 5%+ unmute 180 | bindsym XF86AudioLowerVolume exec amixer -q sset Master 5%- unmute 181 | bindsym XF86AudioMute exec amixer -q sset Master toggle 182 | 183 | #custom bindings to apps 184 | 185 | bindsym $mod+c exec chromium 186 | bindsym $mod+t exec thunar 187 | bindsym $mod+x exec --no-startup-id hexchat 188 | 189 | --------------------------------------------------------------------------------