server – ubuntu, docker, nginx, apache2, need to generate certificate in docker, acme-challenge not saving

I have this structure.

  1. Server ubuntu (host).
  2. Docker nginx, with folders mapping (configuration to host /data/nginx/, certificates to host /data/certs).
  3. Docker apache with app files (php), no mapping to host, conf via proxy_pass.

I need to generate certbot certificate for DOMAIN, but when I tried, there is no possibility save .well-known/acme-challenge, because proxy_pass?

 - The following errors were reported by the server:

   Type:   unauthorized
   Detail: Invalid response from
   (IP): "<!DOCTYPE html>n<!--(if lt IE 7)>      <html
   class="no-js ie lt-ie10 lt-ie9 lt-ie8 lt-ie7" lang="">
   <!(endif)-->n<!--(if IE 7)> "

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address

File DOMAIN.conf.

server {
    listen       443 ssl;
    listen  (::):443 ssl;

    ssl_certificate     /data/certs/DOMAIN.crt;
    ssl_certificate_key /data/certs/DOMAIN.key;

    server_name  DOMAIN
    access_log  /var/log/nginx/DOMAIN.log  main;

    location / {
      proxy_pass http://localhost:7046/;

Is possible generate (save acme) certificate via docker with this configuration? Problem is that certbot is not possible save acme via proxy_pass? Why? And what is the best way to do it (I want to renew certificates automatically in cron then).