How to build image for own jar file
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
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@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@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@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
-- С уважением, А.И.
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@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@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@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
TLDR: You will not be able to run graphical applications in containers. 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@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@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@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@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
Understood. But what is the solution then to deploy this application? Am 05.12.23 um 06:34 schrieb Александр Илюшкин:
TLDR: You will not be able to run graphical applications in containers.
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@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@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@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@lists.podman.io >> To unsubscribe send an email to podman-leave@lists.podman.io > >
Usually, a GUI application is downloaded to a local computer and configured to communicate with services over the network. Since this turned out to be inconvenient, instead of making GUI applications, people usually make web applications, available through a browser. They can be put into a docker container and made accessible by opening a port through the EXPOSE instruction. https://thelinuxcode.com/dockerfile_expose_ports/#:~:text=A%20web%20server%2... вт, 5 дек. 2023 г. в 09:06, Thomas <t.schneider@getgoogleoff.me>:
Understood.
But what is the solution then to deploy this application?
Am 05.12.23 um 06:34 schrieb Александр Илюшкин:
TLDR: You will not be able to run graphical applications in containers.
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@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@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@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@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
-- С уважением, А.И.
On 05.12.2023 08:34, Александр Илюшкин wrote:
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@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@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@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@lists.podman.io >> To unsubscribe send an email to podman-leave@lists.podman.io > >
_______________________________________________ Podman mailing list --podman@lists.podman.io To unsubscribe send an email topodman-leave@lists.podman.io
Hello, I have to say that I run many graphical applications via podman and this saves my a... The problem are for example CAD-software vendors. Their (very powerful and expensive) software *only* runs on e.g. RHEL7. Then containers are your saviour! Just use the centos7 container and "yum" the needed packages for a graphical system and your in business (while keeping your desktop machine bleeded edge). Much less overhead than a full virtual machine. I love podman and the possibility to also run graphical applications in them. (normally in a vnc-server, as vnc is also such a great tool to improve your life). Viele Grüße Michael --------------------------------------- On Tue, 5 Dec 2023, Александр Илюшкин wrote:
TLDR: You will not be able to run graphical applications in containers.
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@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@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@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@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
Thanks, Michael. Yeah, so to summarize everything 1. Decide, whether you have an option to rewrite your gui app to webapp, or your only option is gui. 2. For gui deployment in podman, you have to add additional graphical libraries for Linux, install them inside your dockerfile. 3. Google for articles of how to use graphical environment inside a docker container, this, for instance: https://sgrgyanchandani.medium.com/gui-inside-centos-docker-container-df49f5... С уважением, А. И. вт, 5 дек. 2023 г., 14:12 Michael Traxler <M.Traxler@gsi.de>:
Hello,
I have to say that I run many graphical applications via podman and this saves my a... The problem are for example CAD-software vendors. Their (very powerful and expensive) software *only* runs on e.g. RHEL7. Then containers are your saviour! Just use the centos7 container and "yum" the needed packages for a graphical system and your in business (while keeping your desktop machine bleeded edge). Much less overhead than a full virtual machine.
I love podman and the possibility to also run graphical applications in them. (normally in a vnc-server, as vnc is also such a great tool to improve your life).
Viele Grüße
Michael
---------------------------------------
On Tue, 5 Dec 2023, Александр Илюшкин wrote:
TLDR: You will not be able to run graphical applications in containers.
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@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@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@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@lists.podman.io To unsubscribe send an email to podman-leave@lists.podman.io
participants (4)
-
Michael Traxler -
Thomas -
Александр Илюшкин -
Михаил Иванов