Categories
Mastering Development System & Network

Telnet issues between docker networks

in a host machine (its LAN ip is 192.168.0.94), I have the following services 1) mysql , its docker-compose.yml is as below. It creates a bridge network called mysql_default,it is assigned a VIP 172.24.0.2 version: ‘2’ services: mysql: image: mysql:5.7 restart: always container_name: mysql volumes: – /etc/localtime:/etc/localtime – /data/mysql:/var/lib/mysql ports: – 3306:3306 2) nacos, its […]

Categories
Mastering Development

How to Dockerize a Java application that depends on Maven local repositories?

I have a Java Spring Boot web application that I’d like to containerize using Docker. I’m having trouble getting the mvn install command to work during the Docker build process because my project depends on some other Maven projects I’ve written that are installed in my local /.m2 folder but aren’t available in the Maven […]

Categories
Mastering Development

Docker Mysql 8, Docker spring boot – Failed to configure a DataSource: ‘url’ attribute is not specified

I have spent 2 days, googling, trying all possible permutations combination, but didn’t work out so finally posting here. ->application.properties ## DATASOURCE #local connection #spring.datasource.url=jdbc:mysql://localhost:3306/Apple?useSSL=false&allowPublicKeyRetrieval=true&createDatabaseIfNotExist=true&autoReconnect=true # docker network connection spring.datasource.url=jdbc:mysql://mysqldb_container:3306/Apple?useSSL=false&allowPublicKeyRetrieval=true&createDatabaseIfNotExist=true&autoReconnect=true spring.datasource.username=root spring.datasource.password=root spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver ->build.gradle plugins { id ‘org.springframework.boot’ version ‘2.2.4.RELEASE’; id ‘io.spring.dependency-management’ version ‘1.0.9.RELEASE’ id ‘java’ }; group ‘org.example’; version ‘1.0-SNAPSHOT’; sourceCompatibility = 1.8; repositories […]

Categories
Development

Docker can’t access app in Host when port binding 8080

I have a docker image with a Java spring boot application which starts and run with no problem in a docker container at the port 8080 as you can see in a portion of the logs: 2020-02-24 02:09:07.906 INFO : Tomcat started on port(s): 8080 (http) with context path ‘/web-app’ 2020-02-24 02:09:07.909 INFO : Started […]

Categories
Development

Maven resource filtering not executed

I have a Dockerfile containing the following line: ENTRYPOINT [“java”, “-Dconversion.rules.folder=/var/rules”, “-jar”, “/var/gateway-service-${project.version}.jar”] I am configuring the maven-resources-plugin as following: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>3.1.0</version> <executions> <execution> <id>copy-docker-artifacts</id> <goals> <goal>copy-resources</goal> </goals> <phase>package</phase> <configuration> <resources> <resource> <directory>${project.build.directory}</directory> <includes> <include>${project.artifactId}.tar</include> </includes> </resource> <resource> <directory>${project.basedir}/src/main/docker</directory> <filtering>true</filtering> </resource> </resources> <outputDirectory>${project.build.directory}/docker</outputDirectory> </configuration> </execution> </executions> </plugin> As you can see I am […]

Categories
Development

Google debug: How to debug a library in executable jar – Error : File was not found in the executable

Details: Java app on GKE : Kubernetes I am able to debug all the java files of my executable jar but not the inner jars/libraries. My executable jar’s main code is in implementaion jars/libraries, I have source code of those libraries. How can I debug them? I have used gcr.io/google-appengine/openjdk and added following entry points: […]

Categories
Development Docker

Send post-request from dockerized jar to local python-service

I am running a dockerized jar and a local flask-service on my Mac. The jar represents a web-app for a musical catalogue and the flask-service transforms musical notes into a xml-based music-encoding format. The service is called when the user has clicked on the download button. Starting the application through PyCharm and IntelliJ works fine, […]

Categories
Development Docker MVC Python

Send post-request from dockerized jar to local python-service

I am running a dockerized jar and a local flask-service on my Mac. The jar represents a web-app for a musical catalogue and the flask-service transforms musical notes into a xml-based music-encoding format. The service is called when the user has clicked on the download button. Starting the application through PyCharm and IntelliJ works fine, […]

Categories
Development Docker

Packaging war file into docker image in multiple layers

I’m trying to put a Spring Boot application with war packaging into a docker image. The simplest way to get this can be using the following Dockerfile: FROM adoptopenjdk/openjdk8:alpine-slim VOLUME /tmp COPY target/demo.war app.war ENTRYPOINT [“java”,”-Djava.security.egd=file:/dev/./urandom”,”-jar”,”/app.war”] Following this approach I’m creating a big layer every time I change the project’s source code. An alternative to […]

Categories
Development Docker

Springboot App consumes too much memory on docker

Trying to deploy a containerized springboot app using docker. here’s my Dockerfile: ROM openjdk:8 ADD app-1.0.jar app.jar EXPOSE 8080 ENTRYPOINT [“java”, “-Xmx64m”, “-Xss256k”, “-jar”, “ecalio-landing.jar”] And runned a container like this: sudo docker run -d -m256m –restart=always server.tomcat.max-threads=5 –name=ecalio-landing Once deployed, i used apache benchmark to test the backend and how much requests it can […]