# Certbot in docker

**URL:** <https://community.letsencrypt.org/t/certbot-in-docker/83780>\
**Category:** Help\
**Created:** [January 23, 2019, 2:46pm UTC](https://community.letsencrypt.org/t/certbot-in-docker/83780 "2019-01-23T14:46:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikolay.eremenko](https://avatars.discourse-cdn.com/v4/letter/n/e9a140/32.png) [@nikolay.eremenko](https://community.letsencrypt.org/u/nikolay.eremenko)\
**Post date:** [January 23, 2019, 2:46pm UTC](https://community.letsencrypt.org/t/certbot-in-docker/83780/1 "2019-01-23T14:46:46Z")

</div>

Hi!  
I want to automate the generation certs to docker  
`docker run -it -v $(PWD):/etc/letsencrypt/live \ certbot/dns-dnsimple \ certonly \ --email ex@ex.com \ --agree-tos \ --dns-dnsimple \ --dns-dnsimple-credentials /etc/letsencrypt/live/dnsimple.ini \ --no-eff-email \ -d "*.ex.com" -d ex.com`

and i have in my directory on the local host  
`16:42 cert.pem -> ../../archive/ex.com/cert1.pem`  
`fullchain.pem -> ../../archive/ex.com/fullchain1.pem`  
Now i use `docker cp -L docker-name:/etc/letsencrypt/live/ex.com/fullchain.pem`  
But i want to remove container when it finishes.

Question: how to get certificate files on my local host via docker?  
Thanks!

---

<div class="post-metadata">

**Author:** ![rg305](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/rg305/32/91314_2.png) [@rg305](https://community.letsencrypt.org/u/rg305)\
**Post date:** [January 23, 2019, 9:59pm UTC](https://community.letsencrypt.org/t/certbot-in-docker/83780/2 "2019-01-23T21:59:49Z")

</div>

The simplest solution (which is usually good for long-term) should be always keeping the “contents” of the entire `/etc/letsencrypt` folder; even after the docker container is “destroyed” or even “replaced”.

There may be more than one way to do that.  
I suggest using a “common” path (outside of that docker image) that other systems can be allowed access to for all LE/certbot “app” information and files.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/letsencrypt/original/3X/c/a/ca6c06ea1ea201324bba7048c6841ce60236468d.png) [@system](https://community.letsencrypt.org/u/system)\
**Post date:** [February 22, 2019, 9:59pm UTC](https://community.letsencrypt.org/t/certbot-in-docker/83780/3 "2019-02-22T21:59:53Z")

</div>

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