Dive into Docker as (Java) developer


@ladislavGazo

gazo@seges.sk


... a project


project/
src/
target/
assembly.sbt
build.sbt

or


src/

target/

pom.xml

sonar-project.properties



 



and

shortcuts

aliases
keys
trust stores
connection strings
fancy prompt
Vim plugins
browser
curl
mc
...



The Output






mug





mvnoci

a.k.a.

mvn -o clean install





java -jar target/app.jar


org.postgresql.util.PSQLException: Connection refused

Gimme an elephant





docker run --rm \

                       --name mypg \

                       -ti postgres:9.4.5





telnet localhost 5432




:p





docker ps





docker inspect mypg





telnet 172.17.0.6 5432




:]



docker run --rm \

                       --name mypg \

                       -p 5433:5432

                       -ti postgres:9.4.5





telnet localhost 5432




:-D




 

FROM dockerfile/java:oracle-java8

ENV LANG en_US.utf8

ADD /${project.build.finalName}-exec.jar /home/app/app-server/${project.build.finalName}-exec.jar
ADD /bin /home/app/app-server/bin

EXPOSE 8080

ENTRYPOINT ["/home/app/app-server/bin/start.sh"]




docker build --rm 

-t seges/app-server:1.0.0 .

trailing dot is important





docker run


Together...


docker run --rm --name mypg -p 5433:5432 -ti postgres:9.4.5


docker run --rm --link mypg:db -ti postgres:9.4.5 bash









Compose





Registry








Questions?





@ladislavGazo
gazo@seges.sk

Dive into Docker as (Java) developer

By lgazo

Dive into Docker as (Java) developer

Overview of what a (Java) developer should know about Docker and where to start in order to use it.

  • 1,194