I started using Docker containers a few months ago. I must admit, initially I didn't really see the value in it. But, recently I use containers almost every day. I really started to appreciate Docker containers when I moved this site from a Godaddy hosted Wordpress site to a Digital Ocean droplet. The article Why Use Ghost in a CoreOS Droplet, describes how this site is setup.
Having a CoreOS container running all the time is very handy. For instance, today I wanted to test a Python program for how to do a ping sweep across a network and how to configure Node-RED to require a login and password. In both cases, I just logged into my CoreOS Droplet, created a Docker container, did the test and destroyed the container. Even though I'm using the smallest package available ($5/mo), creating a small container or two doesn't affect the main site at all.
Normally, to do this I'd need to keep a Linux VM on my computer, install the packages, run the test and figure out how to remove the packages. Which is no big deal, but it's pretty easy to just accumulate garbage then have to clean up the VM. Yet another computer to maintain. Yuck. Containers are can be just removed like a file.
Here's an example of the Python test I did.
core@coreos-512mb-nyc3-01 ~ $ docker pull python:2-slim 2-slim: Pulling from library/python 5040bd298390: Already exists b303f6ac5c34: Pull complete 70354f0062a4: Pull complete Digest: sha256:05433e1cd442803108e2e7cfe74701a39f4c12bc93bc4635bd9956ada12b2419 Status: Downloaded newer image for python:2-slim core@coreos-512mb-nyc3-01 ~ $ docker run -it --name python python:2-slim sh # pip install ping Collecting ping Downloading ping-0.2.tar.gz Building wheels for collected packages: ping Running setup.py bdist_wheel for ping ... done Stored in directory: /root/.cache/pip/wheels/3f/85/91/a421c9a20884b182704809dcae37673d67e730ccf03f74e8d6 Successfully built ping Installing collected packages: ping Successfully installed ping-0.2 # python Python 2.7.13 (default, Jan 17 2017, 19:42:07) [GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import ping >>> ping.verbose_ping('220.127.116.11') ping 18.104.22.168 with ... get ping in 2.3551ms ping 22.214.171.124 with ... get ping in 2.0192ms ping 126.96.36.199 with ... get ping in 2.0080ms ping 188.8.131.52 with ... get ping in 1.9960ms >>> exit() # ^D core@coreos-512mb-nyc3-01 ~ $ docker rmi -f python:2-slim Untagged: python:2-slim Untagged: python@sha256:05433e1cd442803108e2e7cfe74701a39f4c12bc93bc4635bd9956ada12b2419 Deleted: sha256:3f14dc7c29da35c25c3fafcef245db0587fa0d086e379c994da26e669359d318 core@coreos-512mb-nyc3-01 ~ $ docker rm -f python python core@coreos-512mb-nyc3-01 ~ $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE ghost latest 783cee09899e 3 weeks ago 325.8 MB
All done. At this point everything used to create the container has been removed, no more cleanup is necessary. The ghost container running the site was completely unaffected.