Docker is by far the most popular application container technology on the market today. It's an open platform that's used the world over by many! Developers in particular, though more and more people are using Docker containers in a production environment and popularity is growing so much that it's likely that vendors may being to deliver their products as containers. Containerizing an application means putting an application into
What is Containerizing an Application and Why do it?
Containerizing an application means putting an application into it's own isolated virtual environment with it's own dedicated file system and everything needed to run the application.
The container runs isolated. This means you can run these containers without worry of conflicts. You can easily and quickly run a container with your application, test it and then remove with no added overhead or ill effects to your system, making containers ideal fo QA testing. No need for dedicated virtual machines, you can take these containers and run them on your primary work laptop, if you like!
When building your application container, you can make sure the app works and then commit that container into an image. This image is like a base or good state of the application. You can pull that image to your system and then re-use as you wish. For example, you may have a large database product in a docker image. Rather than having to go through a lengthy install and configuration any time you want to setup a new instance, you can simply run a new docker container instance from that base docker image. Something that may have taking 20+ minutes through traditional means, now takes under 2 minutes!
Creating multiple unique containers with different variations for testing purposes without needing to re-install or silo the applications. You can also pull images created by others from the ou
It's awesome for creating multiple unique containers with different variations for testing purposes without needing to re-install or silo the applications. You can also pull images created by others from the Docker Hub. It really is a huge weapon in the arsenal of developers!
You are sold!? You may be asking, how do I create my own container?
Begin by installing Docker on your OS of choice by following one of my how to guides:
Note: Not covered here is leveraging Microsoft Azure! Keep an eye out for a future blog post :)
Images and Containers
Once you have installed Docker, you can begin to create your own images: https://docs.docker.com/engine/getstarted/step_four/, remember that an image is a static configuration. The way I like to think about images is like a desktop image or a VM snapshot containing whatever applications and configurations you want. You can then upload this image to the Docker Hub to share with others and to collaborate. You can then create containers based off this static image. You can update this image and ensure those using it get that update instantly.
Docker is awesome for QA testing and collaboration. Rather than installing code on a VM and then providing access to testers, you can simply provide a container they can run from anywhere. No more managing a dedicated infrastructure.
To learn more about images and containers, check this out: https://docs.docker.com/engine/getstarted/step_two/.
For somebody like me who is not a developer, the beauty of containers is my ability to use containers shared in the community. I can run some of my favorite desktop applications and even server applications.
Application Virtualization vs Containers
I have worked for years with application virtualization products like App-V, ThinApp, Symantec Workspace Streaming etc. which are great for virtualizing desktop applications but that doesn't cover everything. What about server apps? With Docker I can run a server application like Wordpress from a container. That's cool for me because this very site is in Wordpress, I can test out changes before making them on my live site. There's many server applications that are very popular with those in the Docker community such as nginx, Apache and even running Linux OS images themselves.
Of course there's still a place for products like App-V. I encourage you to read my blog post on the topic of desktop applications in Docker to see why it's not really the best solution for your desktop applications. App-V is the market leader in that space and now with App-V shipping with Windows 10 and Windows Server 2016, I can see it becoming much more common place.
What is really great about the container space is the development community and the open platform. That is something the appvirt community does not have. Sure there's forums, people sharing templates etc. With Docker people are sharing their completed applications. It's as simple as pull, run and use. Or if you want to modify and share your own varation: pull, run, modify, push.
Create a Wordpress Container
If you followed my how to install guide, you already ran your first container using the hello-world example. This is little tutorial is a more useful :)
If you'd like to try Wordpress for yourself, it's really simple:
Create a wordpress folder in Documents.
Download the docker-compose.yml file in my GitHub repository: https://github.com/Rorymon/docker/blob/master/docker-compose.yml and copy it into the wordpress folder.
Right click on the wordpress folder and click Open in Terminal.
Enter sudo docker-compose -f docker-compose.yml up and hit enter.
After a few seconds Wordpress should be running.
Open your browser and navigate to https://<hostname>:8000 , you now have a running instance of Wordpress running as a docker container!
Docker Cheat Sheet
Now that you've pulled a few images and run a few containers, it may be good to familiarize yourself with some useful commands to managing your containers:
This command will show you the image names and containerids which will be useful for the other commands.
docker start <containerid>
docker stop <containerid>
Pull an image:
docker pull <image> e.g. docker pull Ubuntu or the name of any image currently on the Hub.
Copy a file in a Container to the host:
docker cp [Source]:[Destination]
Mount directory in host to a Container:
docker run -v /host/directory:/container/directory image options
In my Wordpress example, this is really useful for doing things like trying out a downloaded theme.
Stop all containers:
docker stop $(docker ps -a -q)
Delete all containers:
docker rm $(docker ps -a -q)
Delete all images:
docker rmi $(docker images -q)
What about Desktop applications?
I addressed this above in the application virtualization vs containers section but would like to explicitly have a section for Desktop applications. Here it goes:
Docker is very popular for developers and is growing popular with IoT enthusiasts. As Docker doesn't require an OS or hypervisor containers can greatly improve your density and reduce infrastructure costs but what about desktop applications? It is possible, check out my blog post: https://rorymon.com/blog/?p=3768
Realistically, however in it's current form I do not believe Docker as it stands is a suitable product for containerizing desktop applications. If you are like me and you work with Citrix, VDI, Desktops, Applications etc. you should really look at Turbo.net. I will be interested to see if Docker entertains the desktop side of things more in future.
How Can I Manage the Containers in my Environment?
I recently posted a blog about a product called Neuvector. They address a major concern for enterprise customers of Docker. When dealing with an open platform, it's understandable that some may be a little weary. If you leverage something shared within the community, it's possible something malicious is contained within!
Neuvector provides a really lightweight solution to address those security concerns. What's more is it also provides transparency to your administrators of what containers are running in your environment, as well as their network activity e.g. which connect to external ips, which connect to other containers.
They address a major concern for enterprise customers of Docker. When dealing with an open platform, it's understandable that some may be a little weary. If you leverage something shared within the community, it's possible something malicious is contained within!
Neuvector provides a really lightweight solution to address those security concerns. What's more is it also provides transparency to your administrators of what containers are running in your environment, as well as their network activity e.g. which connect to external ips, which connect to other containers etc.