DEV Community

elizabeth-delor
elizabeth-delor

Posted on

How to Install Docker

Docker Download Links

Mac
Windows
Linux

Getting Ready to Install

I personally use a Mac so this tutorial will be mainly following my process. I assume the steps for Windows will be similar and Docker provides Linux users steps to get it running on your device!

For this tutorial I will focus on cloning a GitHub repository and creating a build of it into Docker. I will be using the HaxCms repo in the example.

HaxCms Repo

Prior to the installation, make sure to clone your repo onto your device.

if you are unsure on how to clone your repo follow this tutorial provided by Github

Installation Steps

  1. Install Docker onto your device
  2. Open Docker Desktop once you complete the installation
  3. Create an account (or login to an existing account)

How to Build an Image and Run it

To begin, we will be using that repo cloned earlier.

  1. Open your terminal
  2. Go to the file of your GitHub repo using cd {file path} Example of the file path I used for this example
  3. Enter docker build . -t {name of build} Since I was installing HAXCms, I named my build "hax" so the command I entered was docker build . -t hax
  4. In order to run the container, use docker run -dp 80:80 or go into docker and select using port 80.

The nice thing about Docker is when you go to run your build, this window will pop up.

A photo of the pop-out window which will appear when you run your build in docker

Enter the 80 onto the Local Host portion of this pop up.

  1. Open your browser of choice and enter localhost:80 if you selected a different port, enter the number that reflects it in the local host

Since I used Mac, I did notice that when I attempted to run HaxCms it would not work on Safari but did work on Chrome! So if you are a Mac user as well and having trouble with it on Safari, try to switch over to Chrome.

  1. Once the site runs, you should see your build! In this case I saw this screen.

HAXCms screen

Stopping the container

This is pretty simple! Just open Docker Desktop once again and find the current container that is running. A small menu on the right should be there, one of the options is stop.

Top comments (0)