{"id":1003,"date":"2014-11-11T20:09:21","date_gmt":"2014-11-11T17:09:21","guid":{"rendered":"http:\/\/joseph.zikusooka.com\/?p=1003"},"modified":"2014-11-11T21:13:32","modified_gmt":"2014-11-11T18:13:32","slug":"getting-started-docker-linux","status":"publish","type":"post","link":"https:\/\/joseph.zikusooka.com\/?p=1003","title":{"rendered":"Getting started with Docker on Linux"},"content":{"rendered":"<p><a title=\"Docker\" href=\"http:\/\/www.docker.com\/\" target=\"_blank\">Docker<\/a> containers are all the rage these days. However, if you&#8217;ve used Linux for a while you&#8217;ve come across LXC. For FreeBSD\u00a0users, docker containers will remind you of jails. Docker is essentially the same, but with a better tool chain that makes it easy to build system images and move them around different environments. Docker is also lightweight and very fast when compared to LXC for example.<\/p>\n<p>With traditional office servers increasingly being moved to the cloud, it is easy to see why docker is popular. The ability to deploy and scale easily, makes docker a must-learn tool for IT administrators.<\/p>\n<p>Here are a few notes to get you started with docker. For a detailed instructions, see the official docker <a title=\"User Guide\" href=\"https:\/\/docs.docker.com\/userguide\/\" target=\"_blank\">user guide<\/a>.<\/p>\n<p><strong>Getting started with docker<\/strong><\/p>\n<p>Install docker<br \/>\n<code>yum install docker-io<\/code><br \/>\n(<em>On Red Hat based systems<\/em>)<\/p>\n<p>Start the docker service<br \/>\n<code>systemctl start docker<\/code><\/p>\n<p>Pull docker image from the repository<br \/>\n<code>docker pull fedora<\/code><br \/>\n(<em>Ensure your Internet speed can handle the size of this image<\/em>)<\/p>\n<p>List all images available<br \/>\n<code>docker images<\/code><\/p>\n<p>Run docker image (interactive mode)<br \/>\n<code>docker run -i -t fedora \/bin\/bash<\/code><br \/>\n(<em>Type exit, to get out and leave container running<\/em>)<\/p>\n<p>Show containers current running<br \/>\n<code>docker ps<\/code><\/p>\n<p>To reconnect to the docker instance after exiting:<br \/>\n<code>docker attach [CONTAINER ID]<\/code><\/p>\n<p>To start an existing docker container:<br \/>\n<code>docker start [CONTAINER ID]<\/code><\/p>\n<p>To stop a docker container<br \/>\n<code>docker stop<\/code><\/p>\n<p><strong>How to ship your first container<\/strong><br \/>\nReconnect to the container as shown above.<\/p>\n<p>Show all the changes that were made since initial creation<br \/>\n<code>docker diff [CONTAINER ID]<\/code><\/p>\n<p>Commit your changes<br \/>\n<code>docker commit [CONTAINER ID] [TAG]<\/code><\/p>\n<p>Then to see the newly created image, run<br \/>\n<code>docker images<\/code><\/p>\n<p>You can now share your image. Please note that for the public docker repository, you need to follow the proper naming conventions when picking a tag for your image. Then push the image as follows:<br \/>\n<code>docker push [USERNAME]\/[TAG]<\/code><\/p>\n<p>As you begin to create images using docker, you may want to read <a title=\"Documentation\" href=\"https:\/\/docs.docker.com\/\" target=\"_blank\">documentation<\/a> on dockerfiles and how to use them to quickly deploy your containers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker containers are all the rage these days. However, if you&#8217;ve used Linux for a while you&#8217;ve come across LXC. For FreeBSD\u00a0users, docker containers will remind you of jails. Docker is essentially the same, but with a better tool chain that makes it easy to build system images and move them around different environments. Docker [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"footnotes":""},"categories":[8,9],"tags":[],"class_list":["post-1003","post","type-post","status-publish","format-standard","hentry","category-tools","category-upcoming-technologies"],"_links":{"self":[{"href":"https:\/\/joseph.zikusooka.com\/index.php?rest_route=\/wp\/v2\/posts\/1003","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/joseph.zikusooka.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/joseph.zikusooka.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/joseph.zikusooka.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/joseph.zikusooka.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1003"}],"version-history":[{"count":7,"href":"https:\/\/joseph.zikusooka.com\/index.php?rest_route=\/wp\/v2\/posts\/1003\/revisions"}],"predecessor-version":[{"id":1011,"href":"https:\/\/joseph.zikusooka.com\/index.php?rest_route=\/wp\/v2\/posts\/1003\/revisions\/1011"}],"wp:attachment":[{"href":"https:\/\/joseph.zikusooka.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1003"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/joseph.zikusooka.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1003"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/joseph.zikusooka.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}