Как выполнить Runtime.getRuntime().exec из докер-контейнера ⇐ Linux
Как выполнить Runtime.getRuntime().exec из докер-контейнера
I have code to open a link in a browser. I need to run application with docker, but just calling Runtime.getRuntime().exec(...) executes it inside the Docker container. How can I open the link inside docker container?
if (SystemUtils.IS_OS_LINUX) { // Workaround for Linux because "Desktop.getDesktop().browse()" doesn't work on some Linux implementations if (Runtime.getRuntime().exec(new String[] { "which", "xdg-open" }).getInputStream().read() != -1) { Runtime.getRuntime().exec(new String[] { "xdg-open", url }); } else { log.warn("Error when opening a tab in a browser for Linux OS"); } } else { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().browse(new URI(url)); } else { log.warn("Error when opening a tab"); } } I am trying to add browser to docker container, but as far as I understand this cannot be done.
Источник: https://stackoverflow.com/questions/781 ... -container
I have code to open a link in a browser. I need to run application with docker, but just calling Runtime.getRuntime().exec(...) executes it inside the Docker container. How can I open the link inside docker container?
if (SystemUtils.IS_OS_LINUX) { // Workaround for Linux because "Desktop.getDesktop().browse()" doesn't work on some Linux implementations if (Runtime.getRuntime().exec(new String[] { "which", "xdg-open" }).getInputStream().read() != -1) { Runtime.getRuntime().exec(new String[] { "xdg-open", url }); } else { log.warn("Error when opening a tab in a browser for Linux OS"); } } else { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().browse(new URI(url)); } else { log.warn("Error when opening a tab"); } } I am trying to add browser to docker container, but as far as I understand this cannot be done.
Источник: https://stackoverflow.com/questions/781 ... -container
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Невозможно выполнить команды в Android - runtime.getRuntime (). Exec ()
Anonymous » » в форуме Android - 0 Ответы
- 2 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Невозможно выполнить команды в Android - runtime.getRuntime (). Exec ()
Anonymous » » в форуме Linux - 0 Ответы
- 5 Просмотры
-
Последнее сообщение Anonymous
-