Need help to convert docker run command to a compose format

Hi,

I want to create a docker compose file (portainer) to get the following image running:

docker run --rm \
  -v /var/lib/letsencrypt:/var/lib/letsencrypt \
  -v /etc/letsencrypt:/etc/letsencrypt \
  --cap-drop=all \
  miigotu/certbot-dns-godaddy certbot certonly \
    --authenticator dns-godaddy \
    --dns-godaddy-propagation-seconds 900 \
    --dns-godaddy-credentials /var/lib/letsencrypt/godaddy_credentials.ini \
    --keep-until-expiring --non-interactive --expand \
    --server https://acme-v02.api.letsencrypt.org/directory \
    --agree-tos --email "webmaster@example.com" \
    -d example.com -d '*.example.com'

I’ve got the snippet from following project documentation github > certbot-dns-godaddy.

My first try was to use the web app/service Composerize but sadly an incomplete compose is the result.

Is there another way to get a valid compose file? How can I identify, if something like

--agree-tos --email "webmaster@example.com"

is an environment variable or a command or something else?

Any help is welcome :slight_smile:

Thank you!

Christian

Please share your work in progress state of your compose file. It should be rather simple, as everything after the image name belongs underneath the command: key

1 Like

This is the translation of the docker run command to a compose file:

version: '3.8'
services:
    certbot:
        image: miigotu/certbot-dns-godaddy
        cap_drop:
            - ALL
        volumes:
            - '/var/lib/letsencrypt:/var/lib/letsencrypt'
            - '/etc/letsencrypt:/etc/letsencrypt'
        command: >
            certbot certonly
                --authenticator dns-godaddy
                --dns-godaddy-propagation-seconds 900
                --dns-godaddy-credentials /var/lib/letsencrypt/godaddy_credentials.ini
                --keep-until-expiring --non-interactive --expand
                --server https://acme-v02.api.letsencrypt.org/directory
                --agree-tos --email "webmaster@example.com"
                -d example.com -d '*.example.com'

Just add new lines to the command block. As it indicates that all lines should be merged to a single line with the > character in the beginning, you can simply add additional parameters. BUT: you have to make sure the certbot binary inside the image actually understands the arguments and the value.

1 Like

@meyay thank you for your feedback!

I will check this tomorrow.

Cheers!

@meyay:
Today I have tested your compose.yml after adaption and it works like a charm.

THANK YOU :slight_smile: