Skip to content

Latest commit

 

History

History
216 lines (151 loc) · 4.85 KB

docker.md

File metadata and controls

216 lines (151 loc) · 4.85 KB

What is Docker

Docker is used to run software packages called containers. Containers are isolated from each other and bundle their own application, tools, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating-system kernel and are thus more lightweight than virtual machines. Containers are created from images that specify their precise contents. Images are often created by combining and modifying standard images downloaded from public repositories. -- Wikipedia

Sites

  1. Official Docker site
    1. Documentation
    2. What is a Container?
  2. github.com/docker

Install

Instructions for installing can be found at the Official Docker site. For detailed installation, see Docker docs.

CentOS

There are a few methods to install docker on Ubuntu.

  1. Default yum install
  2. Docker Community Edition

CentOS - Default yum install

  1. Yum install Docker. Example:

    sudo yum install docker
  2. Start Docker. Example:

    sudo systemctl start docker
  3. Optional: Start Docker on reboot. Example:

    sudo systemctl enable docker

CentOS - Docker Community Edition

⚠️ This may be an out-dated method.

  1. Uninstall old docker. Example:

    sudo yum remove docker docker-common docker-selinux docker-engine
  2. CentOS

    sudo yum -y install yum-utils device-mapper-persistent-data lvm2
    sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    sudo yum -y install docker-ce
  3. Start Docker. Example:

    sudo systemctl start docker
  4. Optional: Start Docker on reboot. Example:

    sudo systemctl enable docker
  5. Fix for unable to prepare context.

    Error seen:

    unable to prepare context: unable to 'git clone' to temporary context directory: error initializing submodules: usage: git submodule

    Fix:

    sudo yum install https://centos7.iuscommunity.org/ius-release.rpm
    sudo yum swap git git2u

Ubuntu

There a a few methods to install docker on Ubuntu.

  1. Default apt install
  2. Docker Community Edition

Ubuntu - Default apt install

  1. Apt install Docker. Example:

    sudo apt install docker.io
  2. Proceed to Test

Ubuntu - Docker Community Edition

⚠️ This may be an out-dated method.

  1. Ubuntu

    sudo apt-get update
    
    sudo apt-get 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 \
       $(lsb_release -cs) \
       stable"
    
    sudo apt-get update
    
    sudo apt-get install docker-ce
  2. Proceed to Test

Ubuntu - Past edition

  1. Past version Example:

    sudo apt-get update
    sudo apt -y install apt-transport-https ca-certificates curl software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    sudo apt-get update
    sudo apt -y install docker.io
  2. Proceed to Test

macOS

  1. Install Docker Desktop for Mac

    1. Open Docker.dmg
    2. Drag Docker to Applications
  2. Go to "Applications" and double-click on "Docker"

    1. Check the menu bar for the Docker icon
  3. Test

    1. Open Terminal
    docker --version
    docker-compose --version
    docker-machine --version
    docker run hello-world
  4. Proceed to Test

Windows

  1. Caveat: Requires Windows Pro.
  2. Install Docker Desktop for Windows
    1. Run Docker%20for%20%Windows%20Installer.exe
  3. Proceed to Test

Test

  1. Test

    sudo docker --version
    sudo docker run hello-world

Troubleshooting

References