Skip to content

Commit 81ea2f2

Browse files
committed
Use ENTRYPOINT instead of CMD for Docker
1 parent 6460acb commit 81ea2f2

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

build/docker/build.Dockerfile

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Build & run instructions:
22
# 1. docker build -f build/docker/build.Dockerfile .
3-
# 2. docker run --security-opt "apparmor:unconfined" -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR -e DISPLAY=$DISPLAY -e XAUTHORITY=$XAUTHORITY -e CORE_API_PORT=8085 -e CORE_API_KEY="changeme" --net="host" -v ~/.Tribler:/state -v ~/downloads/TriblerDownloads:/downloads --env DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS" -e XDG_CACHE_HOME=$XDG_CACHE_HOME -v $XDG_CACHE_HOME/tmp/:$XDG_CACHE_HOME/tmp/ -v /run:/run --user $(id -u):$(id -g) -e BROWSER="x-www-browser" -it <<HASH>>
3+
# 2.a. docker run -e CORE_API_PORT=8085 -e CORE_API_KEY="changeme" -v ~/.Tribler:/state -v ~/downloads/TriblerDownloads:/downloads -v $XDG_CACHE_HOME/tmp:/hosttmp -v /run:/run --security-opt "apparmor:unconfined" --net="host" -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR -e DISPLAY=$DISPLAY -e XDG_CACHE_HOME=$XDG_CACHE_HOME -e XAUTHORITY=$XAUTHORITY -e DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS" --user $(id -u):$(id -g) -it <<HASH>>
4+
# 2.b. docker run -e CORE_API_PORT=8085 -e CORE_API_KEY="changeme" -v ~/.Tribler:/state -v ~/downloads/TriblerDownloads:/downloads --net="host" -it <<HASH>> -s
45
#
56
# Common issue: "permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock"
67
# fix: "sudo chmod 666 /var/run/docker.sock"
@@ -19,9 +20,15 @@ RUN tag=`basename $(curl -Ls -o /dev/null -w %{url_effective} https://github.com
1920
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
2021

2122
SHELL ["/bin/bash", "-c"]
22-
CMD export TMPDIR="${XDG_CACHE_HOME}"/tmp/ \
23-
&& mkdir -p ~/custombin \
24-
&& echo '#!/bin/bash' > ~/custombin/x-www-browser \
25-
&& echo 'gdbus call --session --dest=org.freedesktop.portal.Desktop --object-path=/org/freedesktop/portal/desktop --method=org.freedesktop.portal.OpenURI.OpenURI "" "$1" "{}"' >> ~/custombin/x-www-browser \
26-
&& chmod u+x ~/custombin/x-www-browser \
27-
&& PATH=~/custombin:$PATH /usr/share/tribler/tribler
23+
RUN mkdir -p /home/ubuntu/custombin \
24+
&& echo '#!/bin/bash' > /home/ubuntu/custombin/x-www-browser \
25+
&& echo 'gdbus call --session --dest=org.freedesktop.portal.Desktop --object-path=/org/freedesktop/portal/desktop --method=org.freedesktop.portal.OpenURI.OpenURI "" "$1" "{}"' >> /home/ubuntu/custombin/x-www-browser \
26+
&& chmod 777 /home/ubuntu/custombin/x-www-browser
27+
28+
# This is supposed to give icons on Xorg systems, but it doesn't seem to always work.
29+
ENV TMPDIR="/hosttmp/"
30+
31+
ENV PATH="/home/ubuntu/custombin:$PATH"
32+
ENV BROWSER="x-www-browser"
33+
34+
ENTRYPOINT ["/usr/share/tribler/tribler"]

build/docker/compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ services:
1919
network_mode: host
2020
volumes:
2121
# Tray icons
22-
- $XDG_CACHE_HOME/tmp/:$XDG_CACHE_HOME/tmp/
22+
- $XDG_CACHE_HOME/tmp/:/tmp
2323
# Xorg stuff
2424
- /run:/run
2525
# Tribler directories

doc/basics/docker.rst

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ To run the docker image:
3636
--user $(id -u):$(id -g) -e BROWSER="x-www-browser" \
3737
-it ghcr.io/tribler/tribler:latest
3838
39+
*Alternatively*, if you want to run *without opening the web GUI* and *without a tray icon*:
40+
41+
.. code-block::
42+
43+
docker run -e CORE_API_PORT=8085 -e CORE_API_KEY="changeme" \
44+
-v ~/.Tribler:/state -v ~/downloads/TriblerDownloads:/downloads \
45+
--net="host" -it ghcr.io/tribler/tribler:latest -s
46+
3947
You can then open Tribler in your web browser at the URL:
4048

4149
.. code-block::

0 commit comments

Comments
 (0)