title: Stop a running Docker container by sending SIGTERM
body: <p>I have a very very simple Go app listening on port 8080</p>
  
  <pre><code>http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
      w.WriteHeader(200)
      w.Header().Set("Content-Type", "text-plain")
      w.Write([]byte("Hello World!"))
  })
  log.Fatal(http.ListenAndServe(":8080", http.DefaultServeMux))
  </code></pre>
  
  <p>I install it in a Docker container and start it like so:</p>
  
  <pre><code>FROM golang:alpine
  ADD . /go/src/github.com/myuser/myapp
  RUN go install github.com/myuser/myapp
  ENTRYPOINT ["/go/bin/myapp"]
  EXPOSE 8080
  </code></pre>
  
  <p>I then run the container using <code>docker run</code>: </p>
  
  <pre><code>docker run --publish 8080:8080 first-app
  </code></pre>
  
  <p>I expect that, like most programs, I can send a SIGTERM to the process running <code>docker run</code> and this will cause the container to stop running. I observe that sending SIGTERM has no effect, and instead I need to use a command like <code>docker kill</code> or <code>docker stop</code>.</p>
  
  <p>Is this intended behavior? I've asked <a href="https://forums.docker.com/t/docker-run-cannot-be-killed-with-ctrl-c/13108" rel="noreferrer">in the forums</a> and on IRC and gotten no answer.</p>