title: How to get user input in Docker with Go
body: <p>main.go</p>
  <pre><code>package main
  
  import (
      &quot;bufio&quot;
      &quot;os&quot;
      &quot;time&quot;
  )
  
  func main() {
      code, err := bufio.NewReader(os.Stdin).ReadString('\n')
      if err != nil {
          panic(err)
      }
      time.Sleep(time.Second * 10)
  }
  
  </code></pre>
  <p>Dockerfile</p>
  <pre><code>FROM golang:1.17
  
  RUN mkdir -p /usr/src/app
  
  WORKDIR /usr/src/app
  
  COPY . /usr/src/app
  
  
  CMD [&quot;go&quot;,&quot;run&quot;,&quot;main.go&quot;]
  
  </code></pre>
  <p>When create docker container and run it get and error like it:</p>
  <p><a href="https://i.stack.imgur.com/tEZX3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tEZX3.png" alt="enter image description here" /></a></p>
  <p>I want to get user input from terminal when run docker container</p>