It is the content that investigated how to update the executable file specified as the entry point in the docker container.
When developing a Web application with Java or kotlin, I think it is common to set up a docker container for development. Below is a part of the Dockerfile for the application layer container.
FROM openjdk:8-jdk-alpine
COPY build/libs/application.jar application.jar
ENTRYPOINT ["java", "-jar", "application.jar"]
Here's what we're doing in the file: Line 1: Specify base image 2nd line: Copy the built jar file (executable file) from the host side (left) to the container side (right) Line 3: Set up the container startup process (running the jar file you passed above)
The application runs when the command execution process specified at the last entry point is started. During development, the program is rebuilt every time a change is made, but in order to see the change on the actual application, the result of the rebuild must be reflected in the container. A simple method is to stop the created container, delete it, and then rebuild / start the container, but it will take some time (especially rebuilding the container).
One of the solutions to the above problem is as follows.
solution
docker cp build/libs/application-new.jar application.jar
docker restart app
This method does not require rebuilding the container, so the container can be updated in a shorter time.
--docker official documentation http://docs.docker.jp/engine/reference/builder.html#from
Recommended Posts