Docker
Docker is basically a tool that lets you package up an app with everything it needs—code, libraries, settings, So wherever you run it—on your laptop, a server, or in the cloud—it behaves the same way
image vs container
a running image is called container, a container is an instance of image.
For example, image is executable file on you system, container is the process that runs the fils.
workflow
Docker is Client-server model, three ways to interact with it:
- Docker desktop GUI
- command line
- restful api
Docker deamon is the resource manager, it received requests and execute it.
What we need to do is have a Dockerfile
, with no extention.
FROM openjdk:17-jdk-slim
WORKDIR /app
COPY target/my-springboot-app.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]
build the image using dockerfile and publish it to the dockerhub (registry
)
Docker compose
Docker compose is used to solve communication between containers. It can deploy multi-container applications at one time instead of running each container manually.
need a use a yaml file to set the configurations