Congratulations. Dont you want to share your experience with us about how you achieved this.Today I have successfully created my first docker image of a webapp for my vps.
sudo apt-get install proftpd
/java/bin/java -jar /webapp/yourwebappname.jar
FROM debian
COPY www /webapp/www
COPY yourwebappname.jar /webapp
COPY logs /webapp
COPY jdk-11.0.1 /java
COPY start.sh .
EXPOSE 51042
VOLUME /webapp/www/download
VOLUME /webapp/logs
WORKDIR /webapp
CMD ["/bin/sh", "/start.sh"]
hatzisn, well done for getting that working.
A couple of thoughts
#1
You should probably stop using jdk-11.0.1 - it is old and its starting to not trust new SSL certificates. Use the latest version of 11, see thread below.
[Solved] javax.net.ssl.SSLHandshakeException
I have a couple of B4J applications which have operated without error for several years and which include #PackagerProperty: IncludedModules = jdk.crypto.ec as per Tips and special cases 7 in Integrated B4JPackager11 - The simple way to distribute standalone UI apps to specifically deal with...www.b4x.com
#2
As far as I know you shouldnt be specifying "FROM debian" as the base image but rather pull a preconfigured JDK base image.
ie you shouldnt be copying the JRE/JDK directly to the image - this defeats the purpose of a container if you are copying a runtime into the image
You should probably pull this as the base image; https://hub.docker.com/_/eclipse-temurin
See links below.
Getting Started | Spring Boot Docker
Topical guide to using Docker and how to create container images for Spring Boot applicationsspring.io
#3
If I build a blank image with Open JDK 11 the image size is around 400mb, So 580mb is not terrible and probably expected.
There is lots of discusison around why they are so big.
Why are Docker container images so large?
I made a simple image through Dockerfile from Fedora (initially 320 MB). Added Nano (this tiny editor of 1MB size), and the size of the image has risen to 530 MB. I've added Git on top of that (30...stackoverflow.com docker container does not need an OS, but each container has one. Why?
"docker" is a buzz word these days and I'm trying to figure out, what it is and how does it work. And more specifically, how is it different from the normal VM (e.g. VirtualBox, HyperV or WMWarestackoverflow.com
hatzisn, well done for getting that working.
A couple of thoughts
#1
You should probably stop using jdk-11.0.1 - it is old and its starting to not trust new SSL certificates. Use the latest version of 11, see thread below.
[Solved] javax.net.ssl.SSLHandshakeException
I have a couple of B4J applications which have operated without error for several years and which include #PackagerProperty: IncludedModules = jdk.crypto.ec as per Tips and special cases 7 in Integrated B4JPackager11 - The simple way to distribute standalone UI apps to specifically deal with...www.b4x.com
#2
As far as I know you shouldnt be specifying "FROM debian" as the base image but rather pull a preconfigured JDK base image.
ie you shouldnt be copying the JRE/JDK directly to the image - this defeats the purpose of a container if you are copying a runtime into the image
You should probably pull this as the base image; https://hub.docker.com/_/eclipse-temurin
See links below.
Getting Started | Spring Boot Docker
Topical guide to using Docker and how to create container images for Spring Boot applicationsspring.io
#3
If I build a blank image with Open JDK 11 the image size is around 400mb, So 580mb is not terrible and probably expected.
There is lots of discusison around why they are so big.
Why are Docker container images so large?
I made a simple image through Dockerfile from Fedora (initially 320 MB). Added Nano (this tiny editor of 1MB size), and the size of the image has risen to 530 MB. I've added Git on top of that (30...stackoverflow.com docker container does not need an OS, but each container has one. Why?
"docker" is a buzz word these days and I'm trying to figure out, what it is and how does it work. And more specifically, how is it different from the normal VM (e.g. VirtualBox, HyperV or WMWarestackoverflow.com
FROM openjdk:19-jdk-alpine
COPY www /webapp/www
COPY yourwebappname.jar /webapp
COPY logs /webapp
EXPOSE 51042
VOLUME /webapp/www/download
VOLUME /webapp/logs
WORKDIR /webapp
CMD ["java", "-jar", "/webapp/yourwebappname.jar"]
@tchart since it seems you are much more experienced than me in docker I would like to ask you something. My VPS is Debian 10 and my virtual machine is Debian 11. In my virtual machine the image created with Dockerfile in the previous post works but not in my vps. I thought it was because the two containers (my initial with debian and this with alpine and java 19 jdk shared the same external resources but it seems this is not the case. What else can it be? I have connected the new container's network to the nginx proxy manager (NPM) container's network and I have set -p 51041:51042 for the new container and -p 51042:51042 for the initial. When I divert through NPM to the old debian container it works but when I divert to the new openjdk 19 alpine container it does not. Some help please would be highly appreciated.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?