HelloWorld that returns json object
414
Most basic Jetty service. Returns html/js page containing json object to http://ip:port/home Internal port is 8080.
Start with:
docker run -p 8081:8080 koosiedemoer/jsonhello
Access with the following from a browser: http://192.168.99.100:8081/home
DockerFile:
FROM java:alpine
COPY helloworld.jar /home/helloworld.jar
COPY responseText.html /home/responseText.html
COPY helloworld_lib/jetty-all-9.4.3.v20170317-uber.jar /home/helloworld_lib/jetty-all-9.4.3.v20170317-uber.jar
CMD ["java","-jar", "/home/helloworld.jar"]
Notes: Need Docker installed locally. Note that by default it assigns the IP 192.168.99.100 to a container.
If in Windows you need to be in a Windows powerShell prompt ("elevated PowerShell session") to execute docker stuff - get there via
Kitematic >> DOCKER CLI (bottom left)
Command to remove dead containers:
docker rm $(docker ps -a -f status=exited -q)
Command to list relevant images:
docker images koosiedemoer/*:latest
Building:
docker build -t koosiedemoer/jsonhello .
Publishing:
docker login
#docker tag jsonhello koosiedemoer/jsonhello
docker image push koosiedemoer/jsonhello
Content type
Image
Digest
Size
52.6 MB
Last updated
over 9 years ago
docker pull koosiedemoer/jsonhello