Install certbot on nginx

I’m having trouble installing certbot on docker.

Dockerfile

FROM nginx:latest

RUN apt-get update
RUN apt-get install certbot

After this operation, 61.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.
The command ‘/bin/sh -c apt-get install certbot’ returned a non-zero code: 1

It works if I ssh into the container, I simply typed Y