TLDR: You will not be able to run graphical applications in
containers.
Why? For me the following options to "podman run" command allow to run kdevelop
inside the container:
podman run ..... --env DISPLAY=unix$DISPLAY --volume /tmp/.X11-unix:/tmp/.X11-unix
.....
Alternatively I can also run vnc server inside the container.
Rgrds,
--
Михаил Иванов
What do you expect to see as a result of launching the gui
application? There is no graphics system in alpine by default, even if
you add it there, the graphics window somehow needs to be displayed on
your local machine, this will require certain settings to broadcast
the graphics system over the network.
containers usually contain services that are accessible over the
network through an open network port
С уважением, А. И.
пн, 4 дек. 2023 г., 21:34 Thomas <t.schneider(a)getgoogleoff.me>:
Hello,
I need more guidance on this task, and I think one should restart
from
scratch.
This java app "masterpassword-gui" is obviously a graphical frontend,
but I think I didn't reflect this in my dockerfile.
Currently I'm using this dockerfile to build the image:
# Filename: mpw-gui
FROM alpine:latest
RUN apk add openjdk17-jre-headless openjdk17-jre
COPY files/masterpassword-gui.jar
/home/thomas/Software/masterpassword-gui.jar
CMD ["java", "-jar",
"/home/thomas/Software/masterpassword-gui.jar"]
tree /home/thomas/Software/container/mpg-gui/
Software/container/mpg-gui/
├── Dockerfile
└── files
└── masterpassword-gui.jar
1 directories, 2 files
The build is successful, but running the container fails.
Could you please advise how to complete this task?
THX
Am 28.11.23 um 05:20 schrieb Александр Илюшкин:
> Hi, mate.
>
> I believe you can use this answer on SO
>
https://stackoverflow.com/a/35062090 replacing `docker` with
`podman`
> as it fully supports docker API.
>
> So I would write a file named `Dockerfile`:
>
> FROM openjdk:11
> MAINTAINER t.schneider(a)getgoogleoff.me
> COPY~/.mpw-gui/masterpassword-gui.jar /home/masterpassword-gui.jar
> CMD
["java","-jar","/home/masterpassword-gui.jar"]
>
> Notice that I used FROM openjdk:11, you don't have to build your own
> separate openjdk image as it's already built by guys from openjdk,
> please use your current project version of JDK for it:
>
https://hub.docker.com/_/openjdk
>
> Build your image:
>
> podman build -t imageName .
>
> Now invoke your program inside a container:
>
> podman run --name myProgram imageName
>
> Now restart your program by restarting the container:
>
> podman restart myProgram
>
> Your program changed? Rebuild the image!:
>
> podman rmi imageName
> podman build -t imageName .
>
> Additionally, usually we don't build images by hand, we use maven or
> gradle for this.
>
> For instance, google created a tool called JIB, which creates OCI
> images with java programs automatically:
>
https://cloud.google.com/java/getting-started/jib
>
> Also, we use this maven plugin to build docker image with jar
file of
> our project without writing Dockerfile at all:
https://dmp.fabric8.io/
>
> It should work the same way with both docker and podman.
>
> вт, 28 нояб. 2023 г. в 02:02, Thomas <t.schneider(a)getgoogleoff.me>:
>> Hello,
>>
>> I have successfully build docker image "sapmachine", a build of
OpenJDK.
>>
>> Now I want to build my own image to run my own jar file.
>> This jar file is located in ~/.mpw-gui/masterpassword-gui.jar,
and with
>> locally installed OpenJDK I would run this command: java -jar
>> .mpw-gui/masterpassword-gui.jar
>>
>> Could you please advise how to build my own image for this java
application?
>>
>> THX
>> _______________________________________________
>> Podman mailing list -- podman(a)lists.podman.io
>> To unsubscribe send an email to podman-leave(a)lists.podman.io
>
>
_______________________________________________
Podman mailing list --podman(a)lists.podman.io
To unsubscribe send an email topodman-leave(a)lists.podman.io