title: How to run terraform apply --auto-approve in docker container using CMD
body: <p>I am trying to run Terraform within a Docker container in my Windows machine.
  I am actually successfull in running Terraform within a Docker container. However I want to run the command 'terraform apply --auto-approve' instead of plain 'terraform apply' so that terraform dont ask for confirmation to apply the changes.</p>
  <p>I am using AWS as the provider.
  I have a dockerfile of my own which I wrote and it uses hashicorp/terraform:light as the base image.</p>
  <p>The following is my dockerfile:</p>
  <pre><code># Use an official HashiCorp Terraform runtime as a base image.
  FROM hashicorp/terraform:light AS base
  #To create working directory.
  WORKDIR /trojanwall-infra
  # To add contents to the working directory.
  ADD . /trojanwall-infra 
  # Copy the contents.
  COPY . /trojanwall-infra
  # To check the current version of Hashicorp Terraform. 
  
  
  
  # Use the base image to create a packaged image. 
  FROM base AS package
  #To add to the working directory.
  WORKDIR /root/.aws
  # To copy the AWS credentials to root folder.
  COPY ./Key/aws/config /root/.aws
  COPY ./Key/aws/credentials /root/.aws
  
  
  
  # Use the packaged image to create a final image.
  FROM package AS final
  #To add to the working directory.
  WORKDIR /trojanwall-infra
  # To Run Terraform init and initialize.
  RUN terraform init
  #RUN command inside the container.
  CMD [&quot;plan&quot;]
  CMD [&quot;apply&quot;] 
  </code></pre>
  <p>The above dockerfile actually works, but it would ask 'yes'/'no' for confirmation while running as a Docker container.
  I would like to use it somewhat as the following:</p>
  <pre><code>#RUN command inside the container.
  CMD [&quot;apply&quot;, &quot;--auto-approve&quot;] 
  </code></pre>
  <p>But it says that this is an invalid format. Guess dockerfile's CMD cannot run multiple commands this way.</p>
  <p>Can anyone provide some insight and help me out?</p>