Reference for Springboot -Docker
docker build -t springboot-docker:0.1.RELEASE .
Argument to build image from docker file
-t
is image name
:0.1.RELEASE
is the tag name
.
is for location of docker file
docker images
display the created images and their ids, tags, dates, sizes
docker run -p 8080:8080 -d springboot-docker
run the image in a container using port mapping as HostPort:ContainerPort,
containers have their private network,
-d
detach mood so it will run in background,
followed by image name, which I created earlier,
ctl+C to kill the docker instance = stop container,
<< it returns id of container, we can use the first 4 digits,
docker ps
docker logs -f de77
tail the logs of container starting with de77
docker stop de77
stop container with id de77, as it runs in detach mood
docker ps
Repositories on docker hub are images like username\imageName
cli login as: docker login
then write username and password
Associate local image with repository
docker tag springboot-docker dockonmoon/springboot-docker:0.1.RELEASE
Push the tagged image to my repo with tag release
docker push dockonmoon/springboot-docker:0.1.RELEASE