Bug 40119 - We need a simple way to run commands inside a docker app container
We need a simple way to run commands inside a docker app container
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: App Center
UCS 4.1
Other Linux
: P5 normal (vote)
: UCS 4.1-0-errata
Assigned To: Dirk Wiesenthal
Daniel Tröder
:
Depends on:
Blocks: 40192
  Show dependency treegraph
 
Reported: 2015-11-27 15:34 CET by Dirk Wiesenthal
Modified: 2015-12-09 16:47 CET (History)
2 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Wiesenthal univentionstaff 2015-11-27 15:34:51 CET
This already works:

  docker exec $(ucr get appcenter/apps/$appid/container) COMMAND

But this is hard to explain and not very pretty.

We would need something like

  univention-app within $appid COMMAND

to enable ISVs to write pretty documentations.

Default should be /bin/bash

Better use -it (interactive terminal)
Comment 1 Dirk Wiesenthal univentionstaff 2015-11-30 23:41:19 CET
Fixed in
  univention-appcenter 5.0.19-18.77.201511302249

Command is
  univention-app shell $appid COMMAND

Default for COMMAND:
  DockerShellCommand in the app's ini file (which defaults to /bin/bash)

Done for containers not having /bin/bash, so that this can be overridden to /bin/sh. Leaving it empty rejects univention-app shell commands.
Comment 2 Dirk Wiesenthal univentionstaff 2015-12-03 13:55:29 CET
Do not log command to stdout; do not require -- to pass args to command
  univention-appcenter 5.0.19-19.78.201512031352
Comment 3 Daniel Tröder univentionstaff 2015-12-03 14:26:17 CET
OK: advisory
OK: Tests:

# touch /var/lib/docker/overlay/3b905a333141eed75eff4aedab7ad0f81cce01c7a938a32d016dec51851e2b21/merged/in_dudle-docker_container

# ls /in_dudle-docker_container
ls: Zugriff auf /in_dudle-docker_container nicht möglich: Datei oder Verzeichnis nicht gefunden

# univention-app shell dudle-docker ls -l /in_dudle-docker_container
-rw-r--r-- 1 root root 0 Dec  3 14:21 /in_dudle-docker_container

# univention-app shell dudle-docker cp --help
Usage: cp [OPTION]... [-T] SOURCE DEST
  or:  cp [OPTION]... SOURCE... DIRECTORY
  or:  cp [OPTION]... -t DIRECTORY SOURCE...
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
[→ '--help' goes to command, not univention-app]

# univention-app shell --help 
usage: univention-app shell [-h] app ...
[→ '--help' goes univention-app]
Comment 4 Daniel Tröder univentionstaff 2015-12-08 08:26:55 CET
TERM environment variable not set:

# univention-app shell dudle-docker
root@dudle-docker-1449012158371627:/# top
TERM environment variable not set.


Please change the call for shell without command to copy the TERM var from the users env. For example:

# docker exec -it 36defb298cc3 /bin/sh -c "export TERM=$TERM; cd \$HOME; exec /bin/bash"
Comment 5 Dirk Wiesenthal univentionstaff 2015-12-08 11:27:45 CET
(In reply to Daniel Tröder from comment #4)
> TERM environment variable not set:
> 
> # univention-app shell dudle-docker
> root@dudle-docker-1449012158371627:/# top
> TERM environment variable not set.
> 
> 
> Please change the call for shell without command to copy the TERM var from
> the users env. For example:
> 
> # docker exec -it 36defb298cc3 /bin/sh -c "export TERM=$TERM; cd \$HOME;
> exec /bin/bash"

Yes, I opened a new bug for it: Bug#40192
Comment 6 Janek Walkenhorst univentionstaff 2015-12-09 16:47:11 CET
<http://errata.software-univention.de/ucs/4.1/27.html>