Creando mi propia imagen

De Wiki de EGC
Saltar a: navegación, buscar

Podemos modificar una imagen existente y guardarla con un nombre diferente:

# docker run -it ubuntu bash
root@d66f7a3268e6:/#

Fijaros en que el prompt del interprete de ordenes ha cambiado e indica el numero que identifica de manera unica al contenedor que hemos lanzado. Este numero cambia para cada nueva instancia que lanzamos.

# apt-get update
# apt-get install apache2
apt-get install apache2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  apache2-bin apache2-data apache2-utils file ifupdown iproute2
  isc-dhcp-client isc-dhcp-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3
  libaprutil1-ldap libasn1-8-heimdal libatm1 libdns-export162 libexpat1
  libffi6 libgdbm3 libgmp10 libgnutls30 libgssapi3-heimdal libhcrypto4-heimdal
  libheimbase1-heimdal libheimntlm0-heimdal libhogweed4 libhx509-5-heimdal
  libicu55 libidn11 libisc-export160 libkrb5-26-heimdal libldap-2.4-2
  liblua5.1-0 libmagic1 libmnl0 libnettle6 libp11-kit0 libperl5.22
  libroken18-heimdal libsasl2-2 libsasl2-modules libsasl2-modules-db
  libsqlite3-0 libssl1.0.0 libtasn1-6 libwind0-heimdal libxml2 libxtables11
  mime-support netbase openssl perl perl-modules-5.22 rename sgml-base
  ssl-cert xml-core
The following NEW packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils file ifupdown iproute2
  isc-dhcp-client isc-dhcp-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3
  libaprutil1-ldap libasn1-8-heimdal libatm1 libdns-export162 libexpat1
  libffi6 libgdbm3 libgmp10 libgnutls30 libgssapi3-heimdal libhcrypto4-heimdal
  libheimbase1-heimdal libheimntlm0-heimdal libhogweed4 libhx509-5-heimdal
  libicu55 libidn11 libisc-export160 libkrb5-26-heimdal libldap-2.4-2
  liblua5.1-0 libmagic1 libmnl0 libnettle6 libp11-kit0 libperl5.22
  libroken18-heimdal libsasl2-2 libsasl2-modules libsasl2-modules-db
  libsqlite3-0 libssl1.0.0 libtasn1-6 libwind0-heimdal libxml2 libxtables11
  mime-support netbase openssl perl perl-modules-5.22 rename sgml-base
  ssl-cert xml-core
0 upgraded, 57 newly installed, 0 to remove and 4 not upgraded.
Need to get 22.6 MB/22.6 MB of archives.
After this operation, 102 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Escribo 'Y' y pulso enter para comenzar la instalacion del servidor web apache2.

# exit
# docker commit -m "Imagen de ubuntu con apache2" -a "profe" XXXXXX ubuntu/apache2