Create your First Docker Container

Docker is the most popular container technology tool use in the industry. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. Because of this developers can rest assure that the developed application work on any other Linux machine and renegades of any customization made.

Docker allows applications to use the same Linux kernel as the system that they’re running on and only requires applications be shipped with things not already running on the host computer. This gives a significant performance boost and reduces the size of the application.

Lets see how its done

Create a Docker container (Creating Ubuntu container)

docker run -it ubuntu /bin/bash

create a container

-i = Interactive Mode
-t = Use tls

Update the Container OS and Install Ruby

#Install OS updates
apt-get update 

#Install Ruby 
apt-get install -y ruby2.0-dev

Update the container

Install ruby

Commit the changes to container and create a Image of the container

#Get the Containers 
docker ps -a

#Commit the Changes and create a Image 
docker commit -m "install ruby" -a "kasun" 583cc7b4df02 kasun\rubyinstall

get containers

commit and create a image

Now you can use newly created image to create another container

Additional Resources

Build your own images