docs:virtualizacion:docker

Docker

Instalación de docker en MacOS X mediante Home Brew

$ brew install boot2docker
==> Cloning https://github.com/boot2docker/boot2docker-cli.git
Cloning into '/Library/Caches/Homebrew/boot2docker--git'...
remote: Counting objects: 42, done.
remote: Compressing objects: 100% (38/38), done.
remote: Total 42 (delta 2), reused 13 (delta 2)
Unpacking objects: 100% (42/42), done.
Checking connectivity... done
Note: checking out 'deafc1910fe956666a27f0d21eeb8a0da296dbf4'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

==> Checking out tag v1.3.0
==> go get -d
==> make goinstall
🍺  /usr/local/Cellar/boot2docker/1.3.0: 2 files, 7.2M, built in 12 seconds

Realizar configuración inicial:

$ boot2docker init
Latest release for boot2docker/boot2docker is v1.3.0
Downloading boot2docker ISO image...
Success: downloaded https://github.com/boot2docker/boot2docker/releases/download/v1.3.0/boot2docker.iso
    to /Users/rodolfo/.boot2docker/boot2docker.iso
Generating public/private rsa key pair.
Your identification has been saved in /Users/rodolfo/.ssh/id_boot2docker.
Your public key has been saved in /Users/rodolfo/.ssh/id_boot2docker.pub.
The key fingerprint is:
7b:ab:dc:e6:bb:56:ee:98:53:bf:49:8f:b4:0c:78:b9 rodolfo@barbie.local
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|                 |
|                 |
|        S        |
|         . .o.   |
|        . o++.o  |
|       . o+=.*.= | 
|        o=O=E *..|
+-----------------+
$ boot2docker start
Waiting for VM and Docker daemon to start...
............................oooooooooooooooooooooo
Started.
Writing /Users/rodolfo/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/rodolfo/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/rodolfo/.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/rodolfo/.boot2docker/certs/boot2docker-vm
  export DOCKER_TLS_VERIFY=1

Ejecutar los 3 export sugeridos

$ 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/

Ya está el ambiente pronto!

$ docker run -it ubuntu bash
Unable to find image 'ubuntu' locally
ubuntu:latest: The image you are pulling has been verified
d497ad3926c8: Pull complete 
c5fcd5669fa5: Pull complete 
49bb1c57a82c: Pull complete 
67983a9b1599: Pull complete 
88fba6f3d2d8: Pull complete 
eca7633ed783: Pull complete 
511136ea3c5a: Already exists 
Status: Downloaded newer image for ubuntu:latest
root@56729fc5f041:/# 
root@56729fc5f041:/# 
root@56729fc5f041:/# echo "soy un lindo contenedor!"
soy un lindo contenedor!
root@56729fc5f041:/# 
root@56729fc5f041:/# exit
exit
  • docs/virtualizacion/docker.txt
  • Última modificación: 2014/12/08 01:28
  • por 127.0.0.1