title: Create a Docker Apache image with LetsEncrypt
body: <p>I have a trouble with Docker and LetsEncrypt.</p>
  
  <p>As far as I can understand, Certbot (the bot to install LetsEncrypt on Apache or any HTTP Server) checks if the user owns the domain associated to the certificate.</p>
  
  <p>So in the Dockerfile, I add the following line :</p>
  
  <pre><code>RUN certbot --apache -n --agree-tos --email me@mail.com -d domain.tld
  </code></pre>
  
  <p>The trouble is that during domain check, Certbot installs the certificate on the HTTP Server, and checks this server exposes the installed certificate by resolving the domain.</p>
  
  <p>What I mean, is that the domain check can only work if the cerbot command is run on a online web server.</p>
  
  <p>But the Apache Server is not launched during Docker image build.</p>
  
  <p>Do you have any idea to get arround this problem ? I can execute the command after container is launched, but I would like to install the certificate in the Dockerfile.</p>
  
  <p>Thank you</p>