Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Com utilitzar docker-machine

Crear la màquina virtual

Existeix una imatge a l'OpenNebula d'un sistema operatiu on ja està instal·lat el docker i on podem llançar contenidors, es diu boot2docker. També existeix una versió d'Ubuntu.

Si no està disponible, des del Marketplace de l'OpenNebula en la descarreguem. 

Code Block
docker-machine create --driver opennebula --opennebula-image-id [num_imatge_boot2docker] --opennebula-network-id [num_xarxa] [nom_màquina_virtual]

Més opcions:

  • --opennebula-cpu: CPU value for the VM
  • --opennebula-vcpu: VCPUs for the VM
  • --opennebula-memory: Size of memory for VM in MB
  • --opennebula-template-id: Template ID to use
  • --opennebula-template-name: Template to use
  • --opennebula-network-id: Network ID to connect the machine to
  • --opennebula-network-name: Network to connect the machine to
  • --opennebula-network-owner: User ID of the Network to connect the machine to
  • --opennebula-image-id: Image ID to use as the OS
  • --opennebula-image-name: Image to use as the OS
  • --opennebula-image-owner: Owner of the image to use as the OS
  • --opennebula-dev-prefix: Dev prefix to use for the images: 'vd', 'sd', 'hd', etc...
  • --opennebula-disk-resize: Size of disk for VM in MB
  • --opennebula-b2d-size: Size of the Volatile disk in MB (only for b2d)
  • --opennebula-ssh-user: Set the name of the SSH user
  • --opennebula-disable-vnc: VNC is enabled by default. Disable it with this flag

Enllaçar la shell local amb la de la maquina virtual

Code Block
docker-machine env [nom_maàquinamàquina_virtual]
Code Block
eval "$(docker-machine env default[nom_màquina_virtual])"

 Ara ja podem utilitzar docker normalment.

 

Info
titleVariables d'entorn

Per mantenir les noves variables d'entorn de manera persistent, afegiu-les al vostre .profile ($HOME/.profile)