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)

<br />
docker run -it ubuntu /bin/bash<br />

create a container

-i = Interactive Mode
-t = Use tls

Update the Container OS and Install Ruby

<br />
#Install OS updates<br />
apt-get update </p>
<p>#Install Ruby<br />
apt-get install -y ruby2.0-dev<br />

Update the container

Install ruby

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

<br />
#Get the Containers<br />
docker ps -a</p>
<p>#Commit the Changes and create a Image<br />
docker commit -m &quot;install ruby&quot; -a &quot;kasun&quot; 583cc7b4df02 kasun\rubyinstall<br />

get containers

commit and create a image

Now you can use newly created image to create another container

Additional Resources

Build your own images

 

, , , , ,

Post navigation