-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
98 lines (85 loc) · 3.06 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Interactive Brokers' Trader Workstation (TWS) container with GUI
# displaying on the Docker host's X-server.
#
# This is based on alekna/ib-tws Interactive Brokers' Trader
# Workstation (TWS) docker container, which uses VNC to access the
# GUI.
# https://github.com/alekna/docker-ib-tws
#
# It is also based on
# https://tpaschalis.github.io/sandboxed-browser-with-docker
#
# and for a browser sandbox from a container and sound problems (?) fix.
# https://github.com/TheBiggerGuy/docker-pulseaudio-example
#
FROM debian:buster
# Timezone is also in docker-compose file.
ENV HOME /root
ENV TZ Europe/Amsterdam
ENV SHELL /bin/bash
# Install basic Desktop environment for ibtws.
RUN apt-get update; \
apt-get upgrade -y; \
apt-get install -y procps sudo curl less vim-nox zip openbox tint2 pcmanfm xfce4-terminal; \
apt-get clean
RUN sed -i "s#\smain\s*\$# main contrib non-free#" /etc/apt/sources.list
# The Chromium web browser must be installed because TWS apparently
# uses its functionality for e.g. iBot.
#
# Configure browser in TWS settings, as follows:
# /usr/bin/firefox or /usr/bin/chromium
#
RUN apt-get update; \
apt-get install -y \
firefox-esr \
chromium \
chromium-l10n \
fonts-liberation \
fonts-roboto \
hicolor-icon-theme \
libcanberra-gtk-module \
libexif-dev \
libgl1-mesa-dri \
libgl1-mesa-glx \
libpango1.0-0 \
libv4l-0 \
fonts-symbola \
pulseaudio-utils \
libglib2.0-0 \
libavcodec58 \
libavformat58 \
--no-install-recommends; \
rm -rf /var/lib/apt/lists/*; \
apt-get clean
# Create a non-root account to run TWS with.
RUN useradd -ms /bin/bash --uid 1000 --gid 100 tws; \
usermod -G audio,video tws;
# RUN echo "tws ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Check the pulse-client.conf file (is your uid 1000 ?).
COPY pulse-client.conf /etc/pulse/client.conf
USER tws
WORKDIR /home/tws
ENV HOME /home/tws
RUN mkdir -p /home/tws/Downloads; \
mkdir -p /home/tws/Desktop; \
mkdir -p /home/tws/bin
# Retrieve and install TWS (and its embedded JRE). Choose between stable and latest.
# Stable: https://download2.interactivebrokers.com/installers/tws/stable/tws-stable-linux-x64.sh
# Latest: https://download2.interactivebrokers.com/installers/tws/latest/tws-latest-linux-x64.sh
RUN cd /home/tws ; \
curl -sO https://download2.interactivebrokers.com/installers/tws/latest/tws-latest-linux-x64.sh; \
echo "/home/tws/Jts" | sh ./tws-latest-linux-x64.sh; \
rm ./tws-latest-linux-x64.sh
# The DISPLAY variable is required to display TWS on your desktop.
ENV PS1='$ '
ENV DISPLAY=":0"
# Start the installed Interactive Brokers' TWS. Its GUI will display on
# the computer that is hosting the Docker container. Be sure to allow
# access to its X-server via the following command:
# xhost +LOCAL:
#
RUN echo "" >> /home/tws/.bashrc ;\
echo "echo \"Press Ctrl+C within 5 seconds to abort TWS start...\"" >> /home/tws/.bashrc ;\
echo "sleep 5" >> /home/tws/.bashrc ;\
echo "Jts/tws" >> /home/tws/.bashrc
ENTRYPOINT ["/bin/bash"]