mirror of
https://github.com/fcwu/docker-ubuntu-vnc-desktop
synced 2025-12-07 17:06:15 +01:00
feat: support USER
This commit is contained in:
parent
b1d1d2994c
commit
b8f8d21f1d
4 changed files with 43 additions and 18 deletions
|
|
@ -12,7 +12,7 @@ RUN apt-get update \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends --allow-unauthenticated \
|
&& apt-get install -y --no-install-recommends --allow-unauthenticated \
|
||||||
supervisor \
|
supervisor \
|
||||||
openssh-server pwgen sudo vim-tiny \
|
sudo vim-tiny \
|
||||||
net-tools \
|
net-tools \
|
||||||
lxde x11vnc xvfb \
|
lxde x11vnc xvfb \
|
||||||
gtk2-engines-murrine ttf-ubuntu-font-family \
|
gtk2-engines-murrine ttf-ubuntu-font-family \
|
||||||
|
|
|
||||||
13
README.md
13
README.md
|
|
@ -42,17 +42,26 @@ A prompt will ask password either in the browser or vnc viewer.
|
||||||
Screen Resolution
|
Screen Resolution
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
Resolution of virtual desktop adapts browser window size when first connecting the server. You may choose a fixed resolution by passing `RESOLUTION` environment variable, for example
|
The Resolution of virtual desktop adapts browser window size when first connecting the server. You may choose a fixed resolution by passing `RESOLUTION` environment variable, for example
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run -it --rm -p 6080:80 -e RESOLUTION=1920x1080 dorowu/ubuntu-desktop-lxde-vnc
|
docker run -it --rm -p 6080:80 -e RESOLUTION=1920x1080 dorowu/ubuntu-desktop-lxde-vnc
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Default User
|
||||||
|
------------------
|
||||||
|
|
||||||
|
The default user is `root`. You may change the user and password respectively by `USER` and `PASSWORD` environment variable, for example,
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -it --rm -p 6080:80 -e USER=doro -e PASSWORD=password dorowu/ubuntu-desktop-lxde-vnc
|
||||||
|
```
|
||||||
|
|
||||||
Troubleshooting and FAQ
|
Troubleshooting and FAQ
|
||||||
==================
|
==================
|
||||||
|
|
||||||
1. boot2docker connection issue, https://github.com/fcwu/docker-ubuntu-vnc-desktop/issues/2
|
1. boot2docker connection issue, https://github.com/fcwu/docker-ubuntu-vnc-desktop/issues/2
|
||||||
2. Screen resolution is fitted to browser's window size when first connecting to the desktop. If you would like to change resolution, you have to re-create the container
|
|
||||||
|
|
||||||
|
|
||||||
License
|
License
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ command=/usr/bin/Xvfb :1 -screen 0 1024x768x16
|
||||||
user=root
|
user=root
|
||||||
autostart=true
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
stopsignal=QUIT
|
stopsignal=KILL
|
||||||
stdout_logfile=/var/log/xvfb.log
|
stdout_logfile=/var/log/xvfb.log
|
||||||
redirect_stderr=true
|
redirect_stderr=true
|
||||||
|
|
||||||
[program:lxsession]
|
[program:wm]
|
||||||
priority=15
|
priority=15
|
||||||
directory=/root
|
directory=/root
|
||||||
command=/usr/bin/openbox
|
command=/usr/bin/openbox
|
||||||
|
|
@ -23,28 +23,27 @@ redirect_stderr=true
|
||||||
|
|
||||||
[program:lxpanel]
|
[program:lxpanel]
|
||||||
priority=15
|
priority=15
|
||||||
directory=/root
|
directory=%HOME%
|
||||||
command=/usr/bin/lxpanel --profile LXDE
|
command=/usr/bin/lxpanel --profile LXDE
|
||||||
user=root
|
user=%USER%
|
||||||
autostart=true
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
stopsignal=QUIT
|
stopsignal=QUIT
|
||||||
environment=DISPLAY=":1",HOME="/root",USER="root"
|
environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%"
|
||||||
stdout_logfile=/var/log/lxpanel.log
|
stdout_logfile=/var/log/lxpanel.log
|
||||||
redirect_stderr=true
|
redirect_stderr=true
|
||||||
|
|
||||||
[program:pcmanfm]
|
[program:pcmanfm]
|
||||||
priority=15
|
priority=15
|
||||||
directory=/root
|
directory=%HOME%
|
||||||
command=/usr/bin/pcmanfm --desktop --profile LXDE
|
command=/usr/bin/pcmanfm --desktop --profile LXDE
|
||||||
user=root
|
user=%USER%
|
||||||
autostart=true
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
stopsignal=QUIT
|
stopsignal=QUIT
|
||||||
environment=DISPLAY=":1",HOME="/root",USER="root"
|
environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%"
|
||||||
stdout_logfile=/var/log/pcmanfm.log
|
stdout_logfile=/var/log/pcmanfm.log
|
||||||
|
|
||||||
|
|
||||||
[program:x11vnc]
|
[program:x11vnc]
|
||||||
priority=20
|
priority=20
|
||||||
directory=/
|
directory=/
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
mkdir -p /var/run/sshd
|
|
||||||
|
|
||||||
chown -R root:root /root
|
|
||||||
mkdir -p /root/.config/pcmanfm/LXDE/
|
|
||||||
cp /usr/share/doro-lxde-wallpapers/desktop-items-0.conf /root/.config/pcmanfm/LXDE/
|
|
||||||
|
|
||||||
if [ -n "$VNC_PASSWORD" ]; then
|
if [ -n "$VNC_PASSWORD" ]; then
|
||||||
echo -n "$VNC_PASSWORD" > /.password1
|
echo -n "$VNC_PASSWORD" > /.password1
|
||||||
x11vnc -storepasswd $(cat /.password1) /.password2
|
x11vnc -storepasswd $(cat /.password1) /.password2
|
||||||
|
|
@ -18,6 +12,29 @@ if [ -n "$RESOLUTION" ]; then
|
||||||
sed -i "s/1024x768/$RESOLUTION/" /etc/supervisor/conf.d/supervisord.conf
|
sed -i "s/1024x768/$RESOLUTION/" /etc/supervisor/conf.d/supervisord.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
USER=${USER:-root}
|
||||||
|
HOME=/root
|
||||||
|
if [ "$USER" != "root" ]; then
|
||||||
|
useradd --create-home --shell /bin/bash --user-group --groups adm,sudo $USER
|
||||||
|
if [ -z "$PASSWORD" ]; then
|
||||||
|
echo set default password to \"ubuntu\"
|
||||||
|
PASSWORD=ubuntu
|
||||||
|
fi
|
||||||
|
HOME=/home/$USER
|
||||||
|
echo "$USER:$PASSWORD" | chpasswd
|
||||||
|
cp -r /root/.gtkrc-2.0 ${HOME}
|
||||||
|
fi
|
||||||
|
sed -i "s|%USER%|$USER|" /etc/supervisor/conf.d/supervisord.conf
|
||||||
|
sed -i "s|%HOME%|$HOME|" /etc/supervisor/conf.d/supervisord.conf
|
||||||
|
|
||||||
|
# home folder
|
||||||
|
mkdir -p $HOME/.config/pcmanfm/LXDE/
|
||||||
|
ln -sf /usr/share/doro-lxde-wallpapers/desktop-items-0.conf $HOME/.config/pcmanfm/LXDE/
|
||||||
|
chown -R $USER:$USER $HOME
|
||||||
|
|
||||||
|
# clearup
|
||||||
|
PASSWORD=
|
||||||
|
|
||||||
cd /usr/lib/web && ./run.py 2>&1 &
|
cd /usr/lib/web && ./run.py 2>&1 &
|
||||||
nginx -c /etc/nginx/nginx.conf
|
nginx -c /etc/nginx/nginx.conf
|
||||||
exec /bin/tini -- /usr/bin/supervisord -n
|
exec /bin/tini -- /usr/bin/supervisord -n
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue