Using Docker in the Office - tooltwist/documentation GitHub Wiki
1. Install Boot2Docker
If you wish to run Docker containers on a Mac (or Windows machine), you need to run boot2docker. Docker is a Linux-technology, and Boot2Docker is an easy way to run a Linux virtual machine on your Mac. Once boot2docker is running on your machine, all the docker commands will run on your Mac command line as if Docker was running directly on the Mac (rather than inside Boot2docker).
Anyway... install boot2docker (see http://boot2docker.io/). If you already have it installed check the version of Docker it is running using docker -v
and update boot2docker if necessary, to make sure you have Docker 1.3.1 or later (See https://docs.docker.com/installation/mac/#upgrading).
Please NOTE (28th November 2014): boot2docker v1.3.2 has bugs downloading some images ("xz not found" error). Don't use this version.
2. Set environment variables
When you start boot2docker it lists environment variables used to access it. Something like:
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/philipcallender/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
Copy this code and paste it into ~/.profile
, then log off and back in.
3. Update the boot2docker startup options
We need to define a startup parameter to Docker so it will not complain about self-signed certificates on officerepo.local.
$ boot2docker up
$ boot2docker ssh
$ echo 'EXTRA_ARGS="--insecure-registry officerepo.local"' | sudo tee -a /var/lib/boot2docker/profile
$ exit
We'll then need to restart boot2docker, and confirm it is working ok:
$ boot2docker stop; sleep 10; boot2docker up
$ docker ps
If the docker ps
command shows heading and no errors, all is well.
4. Check you can access the repo server
Check you are on the correct network in the office:
$ ping officerepo.local
If you are using wifi, you will probably need to be on "Twistresources Main" wifi. If you are accessing the office via VPN then you may need to add this entry to your /etc/hosts
file:
10.0.1.4 officerepo.local
5. Update your credentials to access Artifactory
In terminal, run this command, with username
and password
replaced with your Artifactory credentials.
$ curl -k -uusername:password "https://officerepo.local/v1/auth"
The output will be something like this:
{
"https://officerepo.local" : {
"auth" : "cGhpbGlwLmNwbGxlbmRlcjpBUERMZDdnVVd1VzVDZAhMMXRmM1JVS3Z3elA=",
"email" : "[email protected]"
}
}
Copy this output into ~/.dockercfg
.
6. Test your setup
$ docker pull officerepo.local/ubuntu
Other Information
Uninstalling boot2docker: http://therealmarv.com/blog/how-to-fully-uninstall-the-offical-docker-os-x-installation/
To downgrade boot2docker, you may need to download the ISO file manually (e.g. https://github.com/boot2docker/boot2docker/releases/download/v1.3.1/boot2docker.iso) and place the file in ~/.boot2docker. Beware that the boot2docker update
or boot2docker download
command may overwrite this file, so perhaps create a backup.