I'm having a tough time wrapping my brain around the possibilities of Docker, so pardon my ignorance here:
Can I take a Docker image of a database server that I've created, and deploy that straight to a fresh EC2 server via some mechanism? Or, would I have to create the EC2 server, then install Docker on the server, then pull in the image into the server, etc.
I'm also perfectly ok with having to write extra code for any portion of this process. I'm just not sure if its possible.
Am I misunderstanding the maximum reach of Docker's usefulness?
The easiest path is to do as you said (create EC2 instance, install Docker, pull image, run image).
If you want to get rid of the overhead of LXC (which is extremely small anyway), there are multiple solutions:
docker export
to generate a tarball of the rootfs of the container, unpack that tarball on the EC2 instance, and chroot there;chroot
runtime to Docker, to do just that but in an automated manner (each docker run
will map to a chroot);FROM
line to a base EC2 AMI, then apply the Dockerfile manually (or e.g. through cloudinit).It is tempting to try to obtain a native image (with the last solution), but it's also the least reliable solution, since there is no way to have a reliable mapping between Docker base images and EC2 base images.
If all your bases are e.g. Ubuntu, you might have pretty good success transforming Dockerfiles into cloudinit templates; but I would personally pick option 1 or 2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With