Intro to docker
This is the code for my intro to docker class. These are the materials for an in-person class, and are not for self-directed learning. This is still being put together. Please clone the repo on the day of the class for the latest materials.
Getting Started
We first need to setup our machines. Click the link for your OS.
macOS Yosemite 10.10.3 or above
if you are on macOS you can brew cask install docker-toolbox or you can download the docker toolbox here. You will then need to install dotnet core.
I don't have a mac so I couldn't test this, but this script might work so long as you have ruby installed:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap caskroom/cask
brew cask install docker-toolbox
brew update
brew install openssl
mkdir -p /usr/local/lib
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
brew cask install dotnet
brew install node
npm install -g npm
npm install -g yeoman generator-docker generator-dotnet
What you will need
if you prefer to not use the scripts I have made you will need the following installed.
- dotnet core
- docker-toolbox
- nodejs
- npm
- yeoman
- generator-docker (npm module)
- generator-dotnet (npm module)
Notes about Windows 7, 8, 8.1, server 2012
Since you are on older verisons of windows you will run the docker kernel as a VM in a hypervisor. Your hypervisors are listed below.
- Win 7 -
virtualbox - Win 8, 8.1, 2012 -
hyperv
We need to create a machine by doing the following. Please note that you must replace MyHypervisor with the hypervisor listed above
# powershell
docker-machine create mydock -d MyHypervisor
Now when we work with docker we need to first configure our shell to tell docker to use this machine (once per shell instance)
# powershell
docker-machine env mydock | invoke-expression
You will then need to docker-machine ls and take note of your docker machine's IP address. When we launch websites in docker instead of browsing on localhost you will browse to your docker machine's IP address.