Comments (4)
I can do this with a Dockerfile along the lines of (Please note I have found most of the code for this from other repos), but would like to add a web access etc for this
FROM ubuntu:bionic
RUN apt-get update; apt-get clean
# Add a user for running applications.
RUN useradd apps
RUN mkdir -p /home/apps && chown apps:apps /home/apps
# Install x11vnc.
RUN apt-get install -y x11vnc
# Install xvfb.
RUN apt-get install -y xvfb
# Install fluxbox.
RUN apt-get install -y fluxbox
# Install wget.
RUN apt-get install -y wget
# Install wmctrl.
RUN apt-get install -y wmctrl
RUN apt-get install -y gnupg
# Set the Chrome repo.
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
# Install Chrome.
RUN apt-get update && apt-get -y install google-chrome-stable
COPY bootstrap.sh /
COPY app /
RUN chmod +x /app
RUN chmod +x /bootstrap.sh
CMD '/bootstrap.sh'
and bootstrap.sh
#!/bin/bash
# Based on: http://www.richud.com/wiki/Ubuntu_Fluxbox_GUI_with_x11vnc_and_Xvfb
readonly G_LOG_I='[INFO]'
readonly G_LOG_W='[WARN]'
readonly G_LOG_E='[ERROR]'
main() {
launch_xvfb
launch_window_manager
run_vnc_server
}
launch_xvfb() {
# Set defaults if the user did not specify envs.
export DISPLAY=${XVFB_DISPLAY:-:1}
local screen=${XVFB_SCREEN:-0}
local resolution=${XVFB_RESOLUTION:-1280x1024x24}
local timeout=${XVFB_TIMEOUT:-5}
# Start and wait for either Xvfb to be fully up or we hit the timeout.
Xvfb ${DISPLAY} -screen ${screen} ${resolution} &
local loopCount=0
until xdpyinfo -display ${DISPLAY} > /dev/null 2>&1
do
loopCount=$((loopCount+1))
sleep 1
if [ ${loopCount} -gt ${timeout} ]
then
echo "${G_LOG_E} xvfb failed to start."
exit 1
fi
done
}
launch_window_manager() {
local timeout=${XVFB_TIMEOUT:-5}
# Start and wait for either fluxbox to be fully up or we hit the timeout.
fluxbox &
local loopCount=0
until wmctrl -m > /dev/null 2>&1
do
loopCount=$((loopCount+1))
sleep 1
if [ ${loopCount} -gt ${timeout} ]
then
echo "${G_LOG_E} fluxbox failed to start."
exit 1
fi
done
}
run_vnc_server() {
local passwordArgument='-nopw'
if [ -n "${VNC_SERVER_PASSWORD}" ]
then
local passwordFilePath="${HOME}/x11vnc.pass"
if ! x11vnc -storepasswd "${VNC_SERVER_PASSWORD}" "${passwordFilePath}"
then
echo "${G_LOG_E} Failed to store x11vnc password."
exit 1
fi
passwordArgument=-"-rfbauth ${passwordFilePath}"
echo "${G_LOG_I} The VNC server will ask for a password."
else
echo "${G_LOG_W} The VNC server will NOT ask for a password."
fi
x11vnc -display ${DISPLAY} -forever ${passwordArgument} &
wait $!
}
control_c() {
echo ""
exit
}
trap control_c SIGINT SIGTERM SIGHUP
main
exit
from docker-baseimage-gui.
The main focus of this baseimage is to run a single application. However, I guess you could install Chrome along with your app and launch it manually when needed. If your app invokes xdg-open to open an URL, you can create a script at /usr/bin/xdg-open
and launch Chrome from there.
Else, you can have a look at https://github.com/fcwu/docker-ubuntu-vnc-desktop for a full desktop.
from docker-baseimage-gui.
from docker-baseimage-gui.
Closing this issue. Please re-open if needed.
from docker-baseimage-gui.
Related Issues (20)
- Ubuntu release peculiarities. HOT 4
- Add specific user for app HOT 3
- "Failed to connect" HOT 10
- Question: maximise only main window HOT 2
- Change the time until the SIGKILL signal. HOT 2
- Persistent Data Storage Issue with Ratioghost Docker Container HOT 2
- Xvnc service fails to start HOT 1
- custom drive mapping. HOT 1
- Run Container as root HOT 2
- Show the side menu once HOT 1
- Missing Font HOT 2
- Request for debian-12 / bookworm baseimage-gui support HOT 1
- baseimage-gui-ubuntu images can't update HOT 3
- Questions: when does openbox rc.xml.template got initialized and how to add a polybar entry HOT 2
- Request for archlinux baseimage-gui support HOT 2
- start unmuted webvnc? HOT 3
- I put wrong topic
- [Feature Request] Web path prefix support HOT 5
- htpasswd - The requested URL returned error: 404 HOT 9
- QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-baseimage-gui.