{"id":57211,"date":"2023-05-01T15:16:34","date_gmt":"2023-05-01T09:46:34","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=57211"},"modified":"2023-05-18T15:22:01","modified_gmt":"2023-05-18T09:52:01","slug":"docker-installation-for-linux-and-mac","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/docker-installation-for-linux-and-mac\/","title":{"rendered":"Docker Installation For Linux And MAC"},"content":{"rendered":"<p><b>FOR LINUX:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">You can install Docker Engine in different ways. Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Below are the steps to install docker on your machine.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">sudo apt-get update<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">sudo apt install apt-transport-https ca-certificates curl software-properties-common<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">curl -fsSL https:\/\/download.docker.com\/linux\/ubuntu\/gpg | sudo apt-key add -<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">sudo add-apt-repository \"deb [arch=amd64] https:\/\/download.docker.com\/linux\/ubuntu focal stable\"<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">sudo apt update<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">apt-cache policy docker-ce<\/span><\/pre>\n<\/li>\n<li><span style=\"font-weight: 400;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-57203 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/1-2.png\" alt=\"\" width=\"735\" height=\"173\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/1-2.png 735w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/1-2-300x71.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/1-2-624x147.png 624w\" sizes=\"(max-width: 735px) 100vw, 735px\" \/><\/span><\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">sudo apt install docker-ce<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">sudo systemctl status docker<\/span><\/pre>\n<\/li>\n<li><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-57204 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/2-2.png\" alt=\"\" width=\"732\" height=\"166\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/2-2.png 732w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/2-2-300x68.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/2-2-624x142.png 624w\" sizes=\"(max-width: 732px) 100vw, 732px\" \/><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">If you want to avoid typing<\/span><span style=\"font-weight: 400;\"> sudo<\/span><span style=\"font-weight: 400;\"> whenever you run the <\/span><span style=\"font-weight: 400;\">docker<\/span><span style=\"font-weight: 400;\"> command, add your username to the <\/span><span style=\"font-weight: 400;\">docker<\/span><span style=\"font-weight: 400;\"> group:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">sudo usermod -aG docker ${USER}<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">su - ${USER}<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">id -nG<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">whoami<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">sudo usermod -aG docker ttn<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">docker<\/span><\/pre>\n<\/li>\n<li><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-57205 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/3-1.png\" alt=\"\" width=\"740\" height=\"281\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/3-1.png 740w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/3-1-300x114.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/3-1-624x237.png 624w\" sizes=\"(max-width: 740px) 100vw, 740px\" \/><\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">docker ps<\/span><\/pre>\n<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Now\u00a0 create a folder for docker setup on pc and follow the below steps:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">pwd<br \/>\n<\/span><\/li>\n<\/ul>\n<p>Make a folder named docker and go inside that folder to run the below command.<\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">git clone <\/span><a href=\"https:\/\/github.com\/wodby\/docker4drupal.git\"><span style=\"font-weight: 400;\">https:\/\/github.com\/wodby\/docker4drupal.git<\/span><\/a><\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">cd docker4drupal\/<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">cp docker4drupal\/traefik.yml<\/span><\/pre>\n<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Make another folder named bootcamp and go inside that folder to run the below command.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">sudo chmod 777 bootcamp<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">cd docker4drupal\/<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">cp docker-compose.override.yml docker-compose.yml .dockerignore .env docker.mk Makefile ..\/bootcamp<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">sudo apt install docker-compose<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">docker-compose --version<\/span><\/pre>\n<\/li>\n<li><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-57206\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/333.png\" alt=\"\" width=\"1\" height=\"1\" \/><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-57208 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/111.png\" alt=\"\" width=\"884\" height=\"400\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/111.png 884w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/111-300x136.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/111-768x348.png 768w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/111-624x282.png 624w\" sizes=\"(max-width: 884px) 100vw, 884px\" \/><\/li>\n<li><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-57207\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/222.png\" alt=\"\" width=\"1\" height=\"1\" \/><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-57209 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/222-1.png\" alt=\"\" width=\"730\" height=\"372\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/222-1.png 730w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/222-1-300x153.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/222-1-624x318.png 624w\" sizes=\"(max-width: 730px) 100vw, 730px\" \/><\/li>\n<li><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-57210 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/333-1.png\" alt=\"\" width=\"674\" height=\"303\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/04\/333-1.png 674w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/333-1-300x135.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/04\/333-1-624x281.png 624w\" sizes=\"(max-width: 674px) 100vw, 674px\" \/><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Above is the installation of drupal from docker.<\/span><\/p>\n<p><strong><em>5 pros of Docker over normal server setup are as follows:<\/em><\/strong><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Docker enables us to build a container image and use that image across every step of the deployment process.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Docker manages to reduce deployment to seconds as it creates a container for every process and does not boot an OS.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Docker ensures consistent environments from development to production.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Docker ensures our applications and resources are isolated and segregated.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Docker containers ensure consistency across multiple development and release cycles,standardizing our environment.<\/span><\/li>\n<\/ol>\n<p><b>FOR MAC:<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Double-click Docker.dmg to open the installer, then drag the Docker icon to the Applications folder.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Double-click Docker.app in the Applications folder to start Docker.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">The Docker menu displays the Docker Subscription Service Agreement window.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">After downloading Docker.dmg, run the following commands in a terminal to install Docker Desktop in the Applications folder:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">sudo hdiutil attach Docker.dmg<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">sudo \/Volumes\/Docker\/Docker.app\/Contents\/MacOS\/install<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400;\">\n<pre><span style=\"font-weight: 400;\">sudo hdiutil detach \/Volumes\/Docker<\/span><\/pre>\n<\/li>\n<\/ul>\n<div class=\"ap-custom-wrapper\"><\/div><!--ap-custom-wrapper-->","protected":false},"excerpt":{"rendered":"<p>FOR LINUX: You can install Docker Engine in different ways. Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository. Below are the steps to install docker on your machine. sudo apt-get update [&hellip;]<\/p>\n","protected":false},"author":1505,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":75},"categories":[3602,1400],"tags":[1883,5230,4862,260,5231],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/57211"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1505"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=57211"}],"version-history":[{"count":4,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/57211\/revisions"}],"predecessor-version":[{"id":57403,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/57211\/revisions\/57403"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=57211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=57211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=57211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}