1DISTROBOX-EXPORT(1)               User Manual              DISTROBOX-EXPORT(1)
2
3
4

NAME

6              distrobox-export
7

DESCRIPTION

9       Application and binary exporting
10
11       distrobox-export  takes  care  of exporting an app or a binary from the
12       container to the host.
13
14       The exported app will be easily available in your normal  launcher  and
15       it  will  automatically  be  launched from the container it is exported
16       from.
17

SYNOPSIS

19       distrobox-export
20
21              --app/-a:       name of the application to export
22              --bin/-b:       absolute path of the binary to export
23              --delete/-d:        delete exported application or binary
24              --export-label/-el: label to add to exported application name.
25                          Use "none" to disable.
26                          Defaults to (on \$container_name)
27              --export-path/-ep:  path where to export the binary
28              --extra-flags/-ef:  extra flags to add to the command
29              --sudo/-S:      specify if the exported item should be run as sudo
30              --help/-h:      show this message
31              --verbose/-v:       show more verbosity
32              --version/-V:       show version
33
34       You may want to install graphical applications or  CLI  tools  in  your
35       distrobox.   Using  distrobox-export from inside the container will let
36       you use them from the host itself.
37

EXAMPLES

39              distrobox-export --app mpv [--extra-flags "flags"] [--delete] [--sudo]
40              distrobox-export --bin /path/to/bin [--export-path ~/.local/bin] [--extra-flags "flags"] [--delete] [--sudo]
41
42       App export example
43
44              distrobox-export --app abiword
45
46       This tool will simply copy the original .desktop files along with need‐
47       ed   icons,  add  the  prefix  /usr/local/bin/distrobox-enter  -n  dis‐
48       trobox_name -e ... to the commands to run, and save them in  your  home
49       to be used directly from the host as a normal app.
50
51       Binary export example
52
53              distrobox-export --bin /usr/bin/code --extra-flags "--foreground" --export-path $HOME/.local/bin
54
55       In  the  case  of exporting binaries, you will have to specify where to
56       export it (--export-path) and the tool will  create  a  little  wrapper
57       script  that will distrobox-enter -e from the host, the desired binary.
58       This can be handy with the use of direnv to have different versions  of
59       the same binary based on your env or project.
60
61       The  exported binaries will be exported in the “–export-path” of choice
62       as a wrapper script that acts naturally both on the  host  and  in  the
63       container.
64
65       Additional flags
66
67       You  can specify additional flags to add to the command, for example if
68       you want to export an electron app, you  could  add  the  “–foreground”
69       flag to the command:
70
71              distrobox-export --app atom --extra-flags "--foreground"
72              distrobox-export --bin /usr/bin/vim --export-path ~/.local/bin --extra-flags "-p"
73
74       This  works  for binaries and apps.  Extra flags are only used then the
75       exported app or binary is used from the host,  using  them  inside  the
76       container will not include them.
77
78       Unexport
79
80       The option “–delete” will un-export an app or binary
81
82              distrobox-export --app atom --delete
83              distrobox-export --bin /usr/bin/vim --export-path ~/.local/bin --delete
84
85       Run as root in the container
86
87       The  option  “–sudo”  will  launch the exported item as root inside the
88       distrobox.
89
90       Exporting apps from rootful containers
91
92       It is worth noting that, when  exporting  any  item  -  which  includes
93       graphical apps - from rootful containers (created with distrobox create
94       --root), root privileges will be needed every time the item is launched
95       (in  order  to enter the rootful container), which, by default, is done
96       using sudo (see docs for distrobox-enter on  how  to  customize  that).
97       However,  for  graphical  apps in specific, since they launch without a
98       terminal, the usage of sudo might, at  first,  make  it  impossible  to
99       launch them.
100
101       To  fix this without needing to customize the sudo program, one can de‐
102       fine a global SUDO_ASKPASS environment variable on their machine, which
103       is  a  PATH  to  an  executable that is run by sudo when no terminal is
104       available (or when it is given the --askpass or  -A  option),  and  the
105       output of that executable to stdout is used as the password input.  The
106       executable is called as many times is needed for authentication as root
107       to succeed (unless a limit of amount of attempts is reached).
108
109       To  do  this, pick a program to ask the user for graphical password in‐
110       put.  In this example, we will use zenity --password, which  should  be
111       present  for  GNOME  users  (and  can also be installed in other DEs) -
112       there are other options, such as kdialog --password "Message"  for  KDE
113       users.
114
115       Write  the call to the desired program to a script file, for example to
116       /usr/bin/my-password-prompt (sample contents below):
117
118              #!/bin/sh
119              zenity --password "Authentication as root is required"
120
121       (You may save the script under, for example, ~/.local/bin if  you  want
122       to keep it fully local to your user.)
123
124       Afterwards,  make  it  executable  (e.g. run sudo chmod +x /usr/bin/my-
125       password-prompt).  Then, make sure to set SUDO_ASKPASS to "/usr/bin/my-
126       password-prompt"  (replace with your script’s path) in a global profile
127       file, so that it is picked up by sudo when running graphical apps (and,
128       therefore, sudo will run the script you created to ask for a password).
129       This    is    done    with    the     shell     line     export     SU‐
130       DO_ASKPASS="/path/to/script/goes/here".   You can do this for your user
131       only by running the command below (replace the script path as needed):
132
133              echo 'export SUDO_ASKPASS="/usr/bin/my-password-prompt"' >> ~/.profile
134
135       Which appends the appropriate line to the end of your ~/.profile  file,
136       thus  making  the  change local to your user.  Alternatively, to set it
137       system-wide (for all users), you may create a file  in  /etc/profile.d/
138       (or equivalent for your system) with that line.
139
140       Now  just  log  out  and  log back in, and graphical apps exported from
141       rootful containers should now be properly asking  for  root’s  password
142       before launching (instead of not opening, if that was the case before).
143
144       Notes
145
146       Note you can use –app OR –bin but not together.
147
148       [IMAGE:          app-export         (https://user-images.githubusercon
149       tent.com/598882/144294795-c7785620-bf68-4d1b-b251-1e1f0a32a08d.png)]
150
151       NOTE: some electron apps such as vscode and atom need additional  flags
152       to work from inside the container, use the --extra-flags option to pro‐
153       vide a series of flags, for example:
154
155       distrobox-export --app atom --extra-flags "--foreground"
156
157
158
159Distrobox                          Nov 2023                DISTROBOX-EXPORT(1)
Impressum