comandos docker.pdf


Vista previa del archivo PDF comandos-docker.pdf


Página 1 2 3 4 5 6 7 8 9 10 11 12 13

Vista previa de texto


Get:3 http://archive.ubuntu.com trusty-updates/main Sources [311 kB]
...
...
...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
Processing triggers for ca-certificates (20141019ubuntu0.14.04.1) ...
Updating certificates in /etc/ssl/certs... 173 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d....done.
---> 2c87ba841537
Removing intermediate container a5c20645fa15
Successfully built 2c87ba841537

13
14
15
16
17
18
19
20
21
22
23
24
25
26

La imagen creada se corresponde con




el nombre (repositorio y tag) ubuntu14.04/utils:0.0.2 y
el ID 2c87ba841537.

Verificamos y arrancamos la nueva imagen
recién creada
Como siempre para arrancar una imagen tenemos que crear el contenedor a partir de la misma.
Verificamos la imagen recién creada

1
2
3
4
5
6

$ docker images
REPOSITORY
TAG
ID
CREATED
ubuntu14.04/utils
0.0.2
ago
221.3 MB
ubuntu14.04/utils
0.0.1
ago
221.3 MB
myrepo/myapp
1.0
ago
259.3 MB
elasticsearch
2.1.0
ago
345.7 MB

IMAGE
VIRTUAL SIZE
2c87ba841537

6 minutes

074f77447d43

31 hours

f4702680b832

8 days

14d91f1920dc

2 weeks

Creamos el contenedor a partir de la imagen

1
2
3
4
5
6

$ docker run -it ubuntu14.04/utils:0.0.2 bash
root@27ebe51743fc:/# which curl wget
/usr/bin/curl
/usr/bin/wget
root@27ebe51743fc:/# exit
exit

Utilizamos el contenedor
El contenedor basado en nuestra imagen se corresponde con

1
2
3
4
5

 el ID 27ebe51743fc y con
 el nombre elated_borg.
$ docker ps -a
CONTAINER
ID
IMAGE
COMMAND
27ebe51743fc
ubuntu14.04/utils:0.0.2
ago

CREATED
"bash"
elated_borg

ST
45 seconds a