Installing and Using Docker Toolbox for Mac OSX and Windows

Similar documents
Using Vagrant and VirtualBox to Run Sandbox Environments

OpenStack Havana All-in-One lab on VMware Workstation

Setting up Docker Datacenter on VMware Fusion

Rancher Part 4: Using the Catalog Example with GlusterFS

Verteego VDS Documentation

The instructions in this document are applicable to personal computers running the following Operating Systems:

Set up, Configure, and Use Docker on Local Dev Machine

Created by: Nicolas Melillo 4/2/2017 Elastic Beanstalk Free Tier Deployment Instructions 2017

1. Install a Virtual Machine Download Ubuntu Create a New Virtual Machine Seamless Operation between Windows an Linux...

Puppet 101 Basic installation for master and agent machines on Ubuntu with VMware Workstation

Using GitHub to Share with SparkFun a

TangeloHub Documentation

GIT. A free and open source distributed version control system. User Guide. January, Department of Computer Science and Engineering

Git Setup Help using GitKraken (CSE 154)

Who is Docker and how he can help us? Heino Talvik

Cleaning up Exited Docker Containers with Help from Awk and Grep

The instructions in this document are applicable to personal computers running the following Operating Systems:

Software Development I

CSCE UVM Hands-on Session-1 Pre-Work

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Introduction to Git and GitHub for Writers Workbook February 23, 2019 Peter Gruenbaum

Swift Web Applications on the AWS Cloud

Setting Up U P D AT E D 1 / 3 / 1 6

Travis Cardwell Technical Meeting

Kivy Designer Documentation

Git Command Line Tool Is Not Installed

Getting Started With Containers

Docker for Developers

LENS Server Maintenance Guide JZ 2017/07/28

bitcurator-access-webtools Quick Start Guide Last updated: May 8th, 2018 Release(s): and later

Git & Github Fundamental by Rajesh Kumar.

IT 341 Introduction to System Administration Project I Installing Ubuntu Server on a Virtual Machine

GETTING STARTED WITH. Michael Lessard Senior Solutions Architect June 2017

Intro to Linux & Command Line

Git Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : October, More documents are freely available at PythonDSP

Gitlab Setup/Usage by Yifeng Zhu modified by Vince Weaver 30 January 2019

Tutorial: Getting Started with Git. Introduction to version control Benefits of using Git Basic commands Workflow

Intro to Github. Jessica Young

Having Fun with Social Coding. Sean Handley. February 25, 2010

Installation and setup guide of 1.1 demonstrator

This tutorial provides a basic understanding of the infrastructure and fundamental concepts of managing an infrastructure using Chef.

2 Initialize a git repository on your machine, add a README file, commit and push

Using RANCID. Contents. 1 Introduction Goals Notes Install rancid Add alias Configure rancid...

Kardia / Centrallix VM Appliance Quick Reference

Lecture 2: Data in Linguistics, Git/GitHub, Jupyter Notebook. LING 1340/2340: Data Science for Linguists Na-Rae Han

Gunnery Documentation

manifold Documentation

ardpower Documentation

Building CircuitPython

It s probably the most popular containerization technology on Linux these days

Setting up GitHub Version Control with Qt Creator*

Singularity CRI User Documentation

Handel-CodePipeline Documentation

CIS 76 Ethical Hacking Building an open source Pentest Sandbox, carrying out a Remote Code Execution exploit, and Remediating the RCE vulnerability.

Improving Your Life With Git

Version Control. Software Carpentry Github s Hello World Git For Ages 4 And Up You need source code control now

Using a Raspberry Pi to Remote Access a Windows Computer

bootmachine Documentation

RETROPIE INSTALLATION GUIDE

Manual Updating Ubuntu Server Command Line

Index. Bessel function, 51 Big data, 1. Cloud-based version-control system, 226 Containerization, 30 application, 32 virtualize processes, 30 31

This video is part of the Microsoft Virtual Academy.

Setting up a Chaincoin Masternode

Index. Alias syntax, 31 Author and commit attributes, 334

Cloud Computing II. Exercises

Chapter 5. Version Control: Git

Using Ruby and irb in CSE 341 Winter 2015

Kardia / Centrallix VM Appliance Quick Reference

Installing Oxwall completely in Amazon Cloud

Table of Contents HOL-SDC-1422

Eugene, Niko, Matt, and Oliver

Raspberry Pi Kernel-o-Matic

Using git to download and update BOUT++

Tools. SWE 432, Fall Design and Implementation of Software for the Web

Welcome to Linux Foundation E-Learning Training

The Old World. Have you ever had to collaborate on a project by

Ubuntu Openstack Installer, Single Machine Mode

Con$nuous Deployment with Docker Andrew Aslinger. Oct

Chapter 15: Using GemStone/S 64 Bit in a VMware Appliance

Creating a Yubikey MFA Service in AWS

Technical Manual. Software Quality Analysis as a Service (SQUAAD) Team No.1. Implementers: Aleksandr Chernousov Chris Harman Supicha Phadungslip

swiftenv Documentation

Post Ubuntu Install Exercises

213/513/613 Linux/Git Bootcamp. Cyrus, Eugene, Minji, Niko

Setting up my Dev Environment ECS 030

Version Control with Git

Infoblox Kubernetes1.0.0 IPAM Plugin

Introduction to Git and Github Repositories

CROWDCOIN MASTERNODE SETUP COLD WALLET ON WINDOWS WITH LINUX VPS

Redhat OpenStack 5.0 and PLUMgrid OpenStack Networking Suite 2.0 Installation Hands-on lab guide

Think Small to Scale Big

Git. Charles J. Geyer School of Statistics University of Minnesota. Stat 8054 Lecture Notes

Installation Instructions

Linux System Management with Puppet, Gitlab, and R10k. Scott Nolin, SSEC Technical Computing 22 June 2017

git commit --amend git rebase <base> git reflog git checkout -b Create and check out a new branch named <branch>. Drop the -b

About SJTUG. SJTU *nix User Group SJTU Joyful Techie User Group

Amazon Web Services Hands on EC2 December, 2012

Lecture 3: Processing Language Data, Git/GitHub. LING 1340/2340: Data Science for Linguists Na-Rae Han

Game Server Manager Documentation

An introduction to Docker

Transcription:

Installing and Using Docker Toolbox for Mac OSX and Windows One of the most compelling reasons to run Docker on your local machine is the speed at which you can deploy and build lab environments. As a huge fan of Vagrant, I love the ability to spin up environments such as the sandbox labs I ve been using for a long time with Vagrant and VirtualBox. Switching to Docker as an option for many of my quick labs has also meant the same ability to run as an abstraction on top of my laptop so that I don t end up in dependency hell with development libraries and underlying infrastructure needs that quickly begin to conflict as I do more testing and development. Installing Docker Toolbox on Mac OSX or Windows The best way to get started is to run the Docker Toolbox platform which deploys a Docker environment with popular and important Docker tools including: docker-engine docker-compose docker-machine Kitematic Navigate over to https://www.docker.com/products/docker-toolbox to get your appropriate version: Rather than document the steps on a continuously changing set of screens, I recommend that you follow the installation process with the tools you desire using the guides provided by Docker here: https://docs.docker.com/toolbox/overview/ Once you re installed, you can kick the tires on Docker using your first Docker Hello World test container using the docker run hello-world command:

You can see that the container image was not local, so a download process started and then the container was launched. As long as you see the results like above, you re in business! We will be using this as a baseline for a lot of other examples in the blog. As usual, this is meant to emulate a basic Docker configuration and does not really reflect a multi-node deployment with overlay networking. The goal is to be able to quickly and easily launch containers using Docker Engine for a number of admin tasks that can replace what we may have been doing inside dedicated workstations or sandbox virtual machines in the past. Deploying a Docker Sandbox using Vagrant and VirtualBox Even with the addition of more client-side tools for running Docker, it still requires installing development tools that may impact your local environment. Plus, I m a fan of using VirtualBox to make sandbox environments that I can spin up and tear down as needed. This means that I never have to worry about version conflicts with development languages and dealing with package management on my Macbook or on my Windows machine. Every machine will use the same recipe. Deploying the VirtualBox Docker Sandbox Environment We are assuming you ve read the initial post, you have already installed Vagrant, VirtualBox and Git. Once you are up to that point and ready to go, we just need to pull down the code to deploy our Docker sandbox using git clone

https://github.com/discoposse/virtualbox-docker-sandbox.git first: Next, change directory into the folder cd virtualbox-docker-sandbox and then run the vagrant up command: That s going to run for a while, and you will see after about 10 minutes that you re back at the prompt. Now we can use vagrant ssh dockersandbox to get onto the console and confirm our environment: You ve got the nested instance running, and as you may have read in the build.sh file from the code we cloned, we have installed docker as well as docker-compose and docker-machine which will help us test the waters on a few different Docker features:

Now you can start up some Docker containers without having touched your local machine at all, and this ensures a clean sandbox deployment for you that is able to be quiesced using the vagrant suspend dockersandbox command: To bring the environment back up, just run a vagrant resume dockersandbox Running Docker as Sudo One thing to note is that we have deployed the Docker runtime as sudo, and because of that we must always run the Docker commands as sudo. This is a best practice in general, so when you try to run docker pull or any docker commands, you will see errors about the daemon not being available: Run the sudo docker pull nginx instead of docker pull nginx and you will see a marked difference in the results:

Happy Dockering! Run the AWS Shell Quickly and Easily in a VirtualBox Instance Using Vagrant Because we like the Martha Stewart pre-baked oven version of things, this is the shortcut to running the AWS CLI without having to dirty up your own local environment. Why use a Sandbox? While development entirely using your local machine is handy, there can often be configuration issues, and also conflicts with other development libraries. In my earlier post, you saw how to configure a basic sandbox environment. I m assuming that you ve already got the following installed as documented in that post: Git client Vagrant VirtualBox This is how to deploy and configure the AWS Shell environment using a sandbox server in just a couple of simple steps! Clone the GitHub Repo From your command line, you can just run a git clone https://github.com/discoposse/virtualbox-aws-shell-sandbox.git to get ready with all the Vagrant code:

Next, we change into the directory and we run a vagrant status to confirm that the configuration is ready to run: We can see that it says not created for the machine, so let s run vagrant up and get this party started! Once the process is completed, you will see this message:

What s in the GitHub Repo to make AWS CLI work? The basic build of a sandbox machine was documented in my previous post, and the secret sauce for this is really quite easy. The only reason I like this approach is that I have a super simple deployment of a purpose-built machine to test out AWS CLI work. All with two simple statement: sudo apt-get install -y python-pip sudo pip install aws-shell Yes, it is just that easy. Once the machine completes the installation, you are ready to log in to the console and give it a try. We do this by running vagrant ssh awssandbox: Et voila! You are now ready to start up the AWS shell. Configuring and Running AWS Shell The environment is all installed. Now, we need to run our AWS shell which will do some basic configuration at the first launch: After the console comes up (it takes about 30 seconds to build the autocomplete cache), we have to configure it to use our AWS credentials.

When we start to type the configure command which you will see does an autocomplete: The three pieces of information you need to configure the AWS shell are your Access Key, your Secret Access Key, and the Region name you are working within. Just like with the web client, you have to choose a default region to explore. That can be changed again at any time by re-running the configure command: We are all set with our configuration, and you can start typing away on the AWS shell commands. There is an autocomplete function on everything, and you can even scroll up and down when the autocomplete suggestions come up: For example, we can list the regions by using the ec2 describe regions command that outputs a JSON response of the available regions:

We can also use the ec2 describe instances command to list out any active instances that are in this region under our account:

The output will span a couple of screens in a prompt window, but luckily we can scroll up or down and also copy the content out from the shell to evaluate in a text editor if you so desired. There are literally hundreds of commands, but the main thing we wanted to see here was how to just get the basic configuration up and running so that you can start exploring. To exit, you can use F10 or Ctrl-D to go back to the Linux shell prompt. Now you have your AWS shell environment ready to save and reuse as needed without having to deploy anything on your home environment. Another advantage is that you can snapshot this one, run it on any platform that supports VirtualBox, and not worry about versioning or anything at all with dependencies at the OS level.

Using Vagrant and VirtualBox to Run Sandbox Environments One of the things that I ve done lately is to ensure that I keep my laptop clean of any development tools. The reason is that I have run into a lot of problems with conflicts around versions, platforms, and general oddities that come as I deploy more and more different environments onto a single machine. Using Virtualbox and Vagrant for Sandboxes Luckily, using Vagrant and VirtualBox is both free and simple. I ve even saved some of the steps by storing basic configs on my GitHub to share and to let the community save some steps. Install VirtualBox Got to http://www.virtualbox.org and you will see a nice shiny button on the main page to take you to the latest download, or you can also just got to https://www.virtualbox.org/wiki/downloads to see the various versions. In my case, I m running Mac OSX, so I will choose the appropriate version. Once it is installed (just take the defaults) then you can run VirtualBox for the first time to complete the initial configuration. Install VirtualBox Guest Additions When you launch VirtualBox for the first time, it will prompt you to install the VirtualBox Guest Additions. This is some add-on features to correct problems on some Linux guests. Since we are going to be using lots of Linux guests, you should run the update. There is no other configuration needed for your VirtualBox because we are going to let Vagrant do all of the configuration from here on in. Install Vagrant Go to https://www.vagrantup.com/downloads.html to get the latest and greatest Vagrant version, and install for your particular Operating System. There are no configuration steps required at all, so just take the defaults and you will be ready to go in a few minutes once the install wizard completes. Install Git Client If you are running OSX, just try to run Git from the command line and it will prompt you to install Xcode. Follow the steps and you will be Git-tastic in no time. Unfortunately, it does take a long time and download a lot of other stuff along with the Git client. For Windows and Linux folks, go to https://git-scm.com/downloads and pick out the version of choice to install.

Create your GitHub Repository For my instances, I use the naming structure virtualbox-productname-sandbox, so if I want to create one to do some nginx testing, I would call it virtualbox-nginx-sandbox as an example. Go to your GitHub account and create a new repository: You will want to do the following steps: Name the repo (virtualbox-nginx-sandbox in my case Set the repo as Public Initialize with a README Add the Apache License 2.0

Next, let s get the URL of the git repo to download and work with: Use your nifty git command line to clone the repository and then we can get started with creating the basic machine:

Make sure that you cd into your folder for the next steps to create the configuration files. Configure a Basic Machine My goto standard is usually an Ubuntu 14.04 LTS instance. This has been the classic for many build environments, so I will just need to set up a very simple Vagrantfile to do this. The Vagrantfile file contents will look as follows: # -*- mode: ruby -*# vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox' Vagrant.configure(VAGRANTFILE_API_VERSION) do config config.vm.define mysandbox" do mysandbox mysandbox.vm.hostname = mysandbox" mysandbox.vm.box = "trusty-server" mysandbox.vm.box_url = "https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04amd64-vbox.box" mysandbox.vm.provision :shell, :path => "build.sh" end end This basic configuration creates an Ubuntu machine named mysandbox and uses NAT networking on an internal network which will have access to the internet and your local network, but does not have a bridged NIC to connect back inside from external resources. You will see that it also calls a shell script named build.sh which is our configuration file to do the basic installs and any customized package deployments. For a basic machine, this is what the build.sh looks like: #!/bin/bash # build.sh Authors: Eric Wright (@DiscoPosse) export DEBIAN_FRONTEND=noninteractive echo "set grub-pc/install_devices /dev/sda" debconf-communicate sudo apt-get update && sudo apt-get upgrade -y

sudo apt-get install -y git vim openssh-server && sudo reboot We are setting the machine to run updates, a kernel upgrade to the latest revision, install a few packages, and then reboot. Configure your.gitignore The most important, but seemingly forgettable step is to create a.gitignore file which stops files from being ingested into a git repository. This is particularly helpful when you have downloads of base boxes, configuration files with passwords and other such local content you want to NOT go back up to the central repo. Here is my basic.gitignore file: *.box.vagrant/ The file is designed to not allow VirtualBox images to be captures, and it also protects the.vagrant folder which creates temporary SSH keys and other content that is mean to be volatile and instancespecific. Now you can simply do a git add to add your files, run a git commit to commit the changes, and finally a big old git push to push your changes up to the remote repository on GitHub. Running your Sandbox Instance It s as easy as vagrant up and once your instance is started, you can run vagrant ssh YOURHOSTNAME where YOURHOSTNAME is the name of the host from your Vagrantfile. Now you have a nifty little sandbox server to run all of your testing without having to much around with tons of configuration and local conflicts. WARNING: You have to remember that this is a sandbox instance and is not storing your changes anywhere except locally. Because you excluded the.box in our.gitignore file, the machine itself is not being backed up to the repository. You won t want to use GitHub to hold your sandbox servers, but you may want the internal code to be stored somewhere. For that reason, please make sure that back up any code you create or special files that need to be saved. Oops I need to Rebuild It s as easy as vagrant destroy and then running vagrant up and you are back up and running with your basic sandbox server. This is helpful when things go a little sideways and you need to go back to the beginning. You can also take snapshots within Virtualbox which I will put into another post soon. Happy sandboxing!