Container does not start in docker

docker-compose.yaml

  certbot:
    depends_on:
      - webserver
    image: certbot/certbot:latest
    container_name: certbot
    env_file: .env.local
    volumes:
      - certbot-etc:/etc/letsencrypt
      - wordpress:/var/www/html
    command: certonly --webroot --webroot-path=/var/www/html --email ${EMAIL} --agree-tos --no-eff-email --staging -d ${DOMAIN} -d www.${DOMAIN}

I launch it, it gives the following and

docker compose logs certbot 
certbot  | usage: 
certbot  |   certbot [SUBCOMMAND] [options] [-d DOMAIN] [-d DOMAIN] ...
certbot  | 
certbot  | Certbot can obtain and install HTTPS/TLS/SSL certificates.  By default,
certbot  | it will attempt to use a webserver both for obtaining and installing the
certbot  | certificate. 
certbot  | certbot: error: argument -m/--email: expected one argument

What's wrong with the command?

Probably the ${EMAIL} variable is not something compatible with Certbot?

1 Like

Yes, that's right, but how can you set parameters through environment variables?

Beats me, I guess that's more a question for the Docker community. :man_shrugging:t2:

2 Likes

if we abstract from Docker, how do we pass arguments to the command line?

Well, now you have just abstracted to asking about o/s shell behavior :slight_smile: That's not really what we specialize in here.

As for Certbot, that value is described in their docs. Note if you provide multiple email addresses do not use spaces around the comma or quote the entire string the same as any other command lines values with imbedded blanks.

-m EMAIL, --email EMAIL
Email used for registration and recovery contact. Use comma to register multiple emails,
ex: u1@example.com,u2@example.com (default: Ask).

https://eff-certbot.readthedocs.io/en/latest/using.html#certbot-command-line-options

3 Likes

If the environment variable EMAIL is set, the ${EMAIL} you are using should work on the command line. But that's more a bash thing than a Certbot thing. Certbot simply expects an email address. (Or multiple as mentioned above.)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.