Docker Installation For Linux And MAC

01 / May / 2023 by Divyanshi Agarwal 0 comments

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
  • sudo apt install apt-transport-https ca-certificates curl software-properties-common
  • curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  • sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
  • sudo apt update
  • apt-cache policy docker-ce
  • sudo apt install docker-ce
  • sudo systemctl status docker

If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group:

  • sudo usermod -aG docker ${USER}
  • su - ${USER}
  • id -nG
  • whoami
  • sudo usermod -aG docker ttn
  • docker
  • docker ps

Now  create a folder for docker setup on pc and follow the below steps:

  • pwd

Make a folder named docker and go inside that folder to run the below command.

Make another folder named bootcamp and go inside that folder to run the below command.

  • sudo chmod 777 bootcamp
  • cd docker4drupal/
  • cp docker-compose.override.yml docker-compose.yml .dockerignore .env docker.mk Makefile ../bootcamp
  • sudo apt install docker-compose
  • docker-compose --version

Above is the installation of drupal from docker.

5 pros of Docker over normal server setup are as follows:

  1. Docker enables us to build a container image and use that image across every step of the deployment process.
  2. Docker manages to reduce deployment to seconds as it creates a container for every process and does not boot an OS.
  3. Docker ensures consistent environments from development to production.
  4. Docker ensures our applications and resources are isolated and segregated.
  5. Docker containers ensure consistency across multiple development and release cycles,standardizing our environment.

FOR MAC:

  • Double-click Docker.dmg to open the installer, then drag the Docker icon to the Applications folder.
  • Double-click Docker.app in the Applications folder to start Docker.
  • The Docker menu displays the Docker Subscription Service Agreement window.

After downloading Docker.dmg, run the following commands in a terminal to install Docker Desktop in the Applications folder:

  • sudo hdiutil attach Docker.dmg
  • sudo /Volumes/Docker/Docker.app/Contents/MacOS/install
  • sudo hdiutil detach /Volumes/Docker
FOUND THIS USEFUL? SHARE IT

Leave a Reply

Your email address will not be published. Required fields are marked *