transferring an existing droplet into a docker image

July 7, 2018 81 views
Docker Let's Encrypt Ubuntu 18.04

Hello,

I'm new to all this and looking for some general advice on what's the best way of transfering my existing DigitalOcean image (droplet) into a docker image.

Thankfully, i'm still at the beginning of my project and I haven't done the code yet, only the configuration/security of the Ubuntu OS along with SSL certificates are done.

My main concerns are:

  1. Do I have to recreate the docker image/configuration, or can I just take the image from DigitalOcean?
  2. If no1 is not possible, how do I reload my SSL certificates using Let's Encrypt/certbot? I've already backed up the "/etc/letsencrypt" folder, do I just need to upload that (after what is done)?

link: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-18-04)

I can't seem to find any tutorials for the above two questions. Any help would be greatly appreciated.

Thank you.

1 Answer

Hello friend!

Happy to help as best I can. Docker might not be the right solution for you, given the question. Docker is at it's best when you separate out each part and create a dockerfile for each container that allows you to spin up new instances of that environment at any time. For example, in a web stack I might have a separate container for each item:

  1. MySQL
  2. Web server
  3. Interpreter (PHP, for example)

You would definitely need to build with Docker in mind rather than build outside and then move into Docker, as it would involve re-tracing a lot of your steps.

For your #2 question there, I assume by reloading the LE cert you mean renewing. Let me know if that is an incorrect assumption. Otherwise, this part of the tutorial will help with that:
https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-18-04#step-5-—-verifying-certbot-auto-renewal

Kind Regards,
Jarland

by Hazel Virdó
by Kathleen Juell
In this tutorial, we will show you how to use Let's Encrypt to obtain a free SSL certificate and use it with Nginx on Ubuntu 18.04. We will also show you how to automatically renew your SSL certificate. If you're running a different web server, simply follow your web server's documentation to learn how to use the certificate with your setup.
  • ok, this answer helps: "You would definitely need to build with Docker in mind rather than build outside and then move into Docker". I will take the time to fully restart my configuration since i'm only at the beginning.

    As for SSL, it looks like most people tend to re-create them instead of backing them up. I just learned that I can register up to 20 certificates a week for one domain. This also means that I don't have to use a volume with Docker for the certificates. sweet

    Thanks.

Have another answer? Share your knowledge.