Docker Install on Mac OS X

Source: Internet
Author: User
Tags nginx server docker hub docker run docker registry


First, Introduction


Docker is an open-source container engine that provides virtual machines to isolate applications that can be ported to any machine with Docker installed, which is a great boon for developers.



For reasons of work, it is recently ready to start using Docker (the Linux server kernel version is too low to recompile when the company installed Docker).



This article mainly explains how to install Docker on Mac OSX.






Tips: Because the Docker engine uses Linux kernel-specific features, you need to install a lightweight virtual machine (such as VirtualBox) to run on OSX.



So you need to download the official Boot2docker to run the Docker daemon.


Second, Docker installation 1. InstallationBoot2docker/Osx-installerFind the latest release version, https://github.com/boot2docker/osx-installer/releases, download pkg, install directly.




Double-click the downloaded pkg package and go to the Installation Wizard:






After installation, you will find that there are 2 more programs in your application:



This is the Boot2docker and VM we mentioned just now:






At this point, the installation steps are complete.


Third, configure the start Docker after the installation is finished boot2docker, you can directly use the Boot2docerk Client command to operate the VM images. 1. Initialize the boot2docker init command


As you can see from the log, the process of initializing is to download a boot2docer.iso and then use SSH to generate the public and private key pair for the SSH for Docker for remote use.


shengli-mac$ boot2docker init
Latest release for boot2docker/boot2docker is v1.3.2
Downloading boot2docker ISO image...
Success: downloaded https://github.com/boot2docker/boot2docker/releases/download/v1.3.2/boot2docker.iso
to /Users/shengli/.boot2docker/boot2docker.iso
Generating public/private rsa key pair.
Your identification has been saved in /Users/shengli/.ssh/id_boot2docker.
Your public key has been saved in /Users/shengli/.ssh/id_boot2docker.pub.
The key fingerprint is:
ff:7a:53:95:e6:44:27:70:e1:ac:0a:b5:02:35:72:29 shengli@192.168.2.101
The key‘s randomart image is:
+--[ RSA 2048]----+

|      . +.  ..o. |

|      E+..   +...|

|      ..  .   +.o|

|       . . . . +.|

|        S . . +. |

|         + .  .. |

|          o  .   |

|           .o    |

|          .o..   |

+-----------------+
2. Start


Boot2docerk Start command to launch



shengli-mac$ boot2docker start
Waiting for VM and Docker daemon to start...
.......................ooooooooooooooooooo
Started.
Writing /Users/shengli/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/shengli/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/shengli/.boot2docker/certs/boot2docker-vm/key.pem

To connect the Docker client to the Docker daemon, please set:
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=/Users/shengli/.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1


Ps: Here host is 192.168.59.103, this is the address of the virtual machine to be accessed later.


shengli-mac$ $(/usr/local/bin/boot2docker shellinit)
Writing /Users/shengli/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/shengli/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/shengli/.boot2docker/certs/boot2docker-vm/key.pem
shengli-mac$ docker version
Client version: 1.3.2
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): 39fa2fa
OS/Arch (client): darwin/amd64
Server version: 1.3.2
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): 39fa2fa


This completes the configuration.



If you want to enter the console of the virtual machine, you can use the Boot2docker SSH command



shengli-mac$ boot2docker ssh
                        ##        .
                  ## ## ##       ==
               ## ## ## ##      ===
           /""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
           \______ o          __/
             \    \        __/
              \____\______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| ‘_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ ‘__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.3.2, build master : 495c19a - Mon Nov 24 20:40:58 UTC 2014
Docker version 1.3.2, build 39fa2fa



Iv. first and second Docker programs for the first one, I believe we all know the HelloWorld of the Docker version. This happens to verify that the installation is successful. 1. Docker HelloWorld running Docker run Hello-world,docker will look for the presence of the mirror locally (definitely not present, just installed = =), then Docker will go to remote Docker registry Server to download the image. Run this image after downloading. This mirror program will output a quote from docker.  if you see this, your Docker is properly installed.
shengli-mac$ docker run hello-world
Unable to find image ‘hello-world‘ locally
hello-world:latest: The image you are pulling has been verified
511136ea3c5a: Pull complete 
7fa0dcdc88de: Pull complete 
ef872312fe1b: Pull complete 
Status: Downloaded newer image for hello-world:latest
Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (Assuming it was not already locally available.)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

For more examples and ideas, visit:
 http://docs.docker.com/userguide/
2, Docker Nginx here will show you download an image of the Nginx server, and then you can access the Docker container port via this computer to access the Nginx deployed in Docker.

Docker run--rm-i-t-p 80:80 nginx
shengli-mac$ docker run --rm -i -t -p 80:80 nginx
Unable to find image ‘nginx‘ locally
nginx:latest: The image you are pulling has been verified
f10807909bc5: Pull complete 
f6fab3b798be: Pull complete 
d21beea329f5: Pull complete 
04499cf33a0e: Pull complete 
34806d38e48d: Pull complete 
343c8475e349: Pull complete 
92360dceda1a: Pull complete 
9495a555677d: Pull complete 
911e2df03930: Pull complete 
88daddf047c6: Pull complete 
db8a64f62509: Pull complete 
e46b3488b010: Pull complete 
511136ea3c5a: Already exists 
Status: Downloaded newer image for nginx:latest

After running, the command will listen listening access, if successful access, you will see the Nginx log:


192.168.59.3 - - [07/Dec/2014:02:24:06 +0000] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36" "-"
2014/12/07 02:24:06 [error] 7#0: *1 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 192.168.59.3, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "192.168.59.103"
192.168.59.3 - - [07/Dec/2014:02:24:06 +0000] "GET /favicon.ico HTTP/1.1" 404 570 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36" "-"

To run the Nginx image on port 80 of Docker, you will see the Nginx Welcome page when you visit docker_host:80.
If you have forgotten the host of the dock, you can use:

Boot2docker IP

shengli-mac$ boot2docker ipthe VM ' s Host only interface IP address is:192.168.59.103
V. Summary


This article explains how to install and deploy Docker on Mac OSX, there are no particularly difficult steps, and VM boot is also a background process, very lightweight.






/applications/virtualbox.app/contents/macos/vboxheadless--comment BOOT2DOCKER-VM--STARTVM 89b84e20-fd75-4ae6-a437-c3b2778aeed1--vrde Config



--eof--



Reference: https://docs.docker.com/installation/mac/



Original article, transfer please specify from: http://blog.csdn.net/oopsoom/article/details/41785999



Docker Install on Mac OS X


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.