title: How to update the application running in the docker container? (for example, spring boot)
body: <p>I'm trying to figure out the docker for the hundredth time. Now I create <code>spring-boot</code> simple application and create <code>docker image</code> for it:</p>
  
  <pre><code>FROM openjdk:8
  EXPOSE 8080
  ADD /build/libs/hello-docker-0.0.1-SNAPSHOT.jar hello-docker.jar
  ENTRYPOINT ["java", "-jar", "hello-docker.jar"]
  </code></pre>
  
  <p>What did i do step by step:</p>
  
  <p>1) Build my app(as a result, my <code>hello-docker-0.0.1-SNAPSHOT.jar</code> appeared in the <code>build</code> folder)</p>
  
  <p>2) moved to the directory where the <code>Docker file</code> is located and executed the command: <code>docker build -f Dockerfile -t springdocker .</code></p>
  
  <p>3) Run this <code>image</code> as container: <code>docker run -p 8080:8080 springdocker</code></p>
  
  <p>As a result, my application started successfully. </p>
  
  <p>But now I decided to change something in my application. I did it and tried to repeat all the steps. <code>1-&gt; 2-&gt; error</code></p>
  
  <p>On 2 stepa new image was created and the old one was in the active state. It turns out that I need to stop the old one and start a new one.</p>
  
  <p>it is not comfortable. I intuitively understand that this is not how it should work. I do not understand how to properly update the container. I constantly change my application and if I need to stop the container then create an image and then launch it - this is not a convenience but a complication. With the same success, I can stop the my application and launch a new one without a docker. I understand that I do not understand how this works, and I want someone to explain to me how to do it.</p>